From d1103345068166b70fc1d97d83034d2c160ebe51 Mon Sep 17 00:00:00 2001 From: g Date: Tue, 21 Mar 2023 12:03:54 +0300 Subject: [PATCH] add filters conditions --- src/Regions.jsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Regions.jsx b/src/Regions.jsx index ad20189..f2285f7 100644 --- a/src/Regions.jsx +++ b/src/Regions.jsx @@ -227,7 +227,7 @@ export default function Regions({ mapOptions, onMapOptionClick }) { const generatePopup = (info) => { - // console.log(info) + console.log(info) const [currentTech, currentSupport, currentYear, currentParameter] = filterFilters.map(f => f.options.find(o => o.checked)).concat(paintFilters[0].options.find(o => o.checked)) return (
@@ -482,7 +482,7 @@ export default function Regions({ mapOptions, onMapOptionClick }) {
- +
@@ -600,10 +600,20 @@ export default function Regions({ mapOptions, onMapOptionClick }) { className="peer h-4 w-4 rounded-full border-gray-400 text-indigo-600 focus:ring-indigo-500 disabled:text-gray-400 disabled:border-gray-200" onChange={handleFilterToggle} disabled={ - paintFilters[0].options.find(o => o.checked).value == "power_fact_mw" && section.id == "year" && option.value > 2022 || - paintFilters[0].options.find(o => o.checked).value == "power_plan_mw" && section.id == "year" && option.value < 2022 ? - true - : false + (paintFilters[0].options.find(o => o.checked).value == "power_fact_mw" && + section.id == "year" && option.value > 2022) || + (paintFilters[0].options.find(o => o.checked).value == "power_plan_mw" && + section.id == "year" && option.value <= 2022) || + (paintFilters[0].options.find(o => o.checked).value == "power_opw_mw" && + section.id == "year" && option.value >= 2024) || + (paintFilters[0].options.find(o => o.checked).value == "generation_mwh" && + section.id == "year" && option.value >= 2023) || + (paintFilters[0].options.find(o => o.checked).value == "res_share_generation" && + (section.id == "year" && (option.value <= 2016 || option.value >= 2023) || section.id == "id_tech" && option.value != 5 || section.id == "id_support" && option.value != 4)) || + (paintFilters[0].options.find(o => o.checked).value == "res_share_power" && + (section.id == "year" && (option.value <= 2016 || option.value >= 2023) || section.id == "id_tech" && option.value != 5 || section.id == "id_support" && option.value != 4)) + ? true + : false } />