From a8e901b63ce0c7c35c48d68029c5e0685b2d2a2e Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 11 Jun 2024 10:05:50 -0500 Subject: [PATCH] UI fixes (#11883) * Keep as optional prop * put zones inside of scrollable container --- .../components/filter/ReviewFilterGroup.tsx | 95 ++++++++++--------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/web/src/components/filter/ReviewFilterGroup.tsx b/web/src/components/filter/ReviewFilterGroup.tsx index 55a624b52..a76b81db6 100644 --- a/web/src/components/filter/ReviewFilterGroup.tsx +++ b/web/src/components/filter/ReviewFilterGroup.tsx @@ -643,7 +643,7 @@ type GeneralFilterContentProps = { updateLabelFilter: (labels: string[] | undefined) => void; setCurrentLabels: (labels: string[] | undefined) => void; updateZoneFilter?: (zones: string[] | undefined) => void; - setCurrentZones: (zones: string[] | undefined) => void; + setCurrentZones?: (zones: string[] | undefined) => void; onClose: () => void; }; export function GeneralFilterContent({ @@ -726,54 +726,59 @@ export function GeneralFilterContent({ /> ))} - - {allZones && setCurrentZones && ( - <> - -
- - { - if (isChecked) { - setCurrentZones(undefined); - } - }} - /> -
-
- {allZones.map((item) => ( - + +
+ + { if (isChecked) { - const updatedZones = currentZones ? [...currentZones] : []; - - updatedZones.push(item); - setCurrentZones(updatedZones); - } else { - const updatedZones = currentZones ? [...currentZones] : []; - - // can not deselect the last item - if (updatedZones.length > 1) { - updatedZones.splice(updatedZones.indexOf(item), 1); - setCurrentZones(updatedZones); - } + setCurrentZones(undefined); } }} /> - ))} -
- - )} +
+
+ {allZones.map((item) => ( + { + if (isChecked) { + const updatedZones = currentZones + ? [...currentZones] + : []; + + updatedZones.push(item); + setCurrentZones(updatedZones); + } else { + const updatedZones = currentZones + ? [...currentZones] + : []; + + // can not deselect the last item + if (updatedZones.length > 1) { + updatedZones.splice(updatedZones.indexOf(item), 1); + setCurrentZones(updatedZones); + } + } + }} + /> + ))} +
+ + )} +