From 453c287625d0437942a04f565bac9a8898fa4f53 Mon Sep 17 00:00:00 2001 From: zojgame Date: Wed, 12 Jun 2024 18:54:30 +0500 Subject: [PATCH] fxs --- .../modals/mobile/MasterplanFiltersModal.tsx | 2 +- .../modals/mobile/SearchFiltersModal.tsx | 27 +++++++++++ src/components/searchPage/SidebarFilters.tsx | 47 ++++++++++++++----- .../ApartmentCard.tsx | 12 +++-- .../ApartmentSidebar.tsx | 47 +++++++++++-------- src/store/useSearchFilters.ts | 6 +++ 6 files changed, 106 insertions(+), 35 deletions(-) diff --git a/src/components/modals/mobile/MasterplanFiltersModal.tsx b/src/components/modals/mobile/MasterplanFiltersModal.tsx index 182bee5..d8a45ba 100644 --- a/src/components/modals/mobile/MasterplanFiltersModal.tsx +++ b/src/components/modals/mobile/MasterplanFiltersModal.tsx @@ -156,7 +156,7 @@ const MasterplanFiltersModal = () => {
-

Apartment type

+

Views

{viewCheckboxes.map((checkbox) => ( { + // const [viewCheckboxes, setViewCheckboxes] = useState( + // initialViewCheckboxes + // ); const { setModal } = useModal(); const { setIsAnimate } = useContext(MobileModalWrapperContext); const { @@ -28,6 +32,8 @@ const SearchFiltersModal = () => { setApartmentTypeCheckboxes, roveHomeTypeCheckboxes, setRoveHomeTypeCheckboxes, + setViewCheckboxes, + viewCheckboxes, } = useSearchFilters(); const handlers = useSwipeable({ onSwipedDown: () => handleOnCrossClick(), @@ -54,6 +60,17 @@ const SearchFiltersModal = () => { setApartmentTypeCheckboxes(updatedCheckboxes); }; + const handleOnViewCheckboxClick = (checkboxId: string) => { + const updatedCheckboxes = viewCheckboxes.map((cbox) => { + if (checkboxId !== cbox.id) return cbox; + const isSelected = !cbox.selected; + + return { ...cbox, selected: isSelected }; + }); + + setViewCheckboxes(updatedCheckboxes); + }; + const handleOnCheckboxRoveHomeClick = (checkboxId: string) => { const updatedCheckboxes = roveHomeTypeCheckboxes.map((cbox) => { if (checkboxId !== cbox.id) return cbox; @@ -101,6 +118,7 @@ const SearchFiltersModal = () => { const handleOnResetClick = () => { setMultirangeSliders(initialSliders); + setViewCheckboxes(initialViewCheckboxes); setApartmentTypeCheckboxes(initialApartmentTypeCheckboxes); setRoveHomeTypeCheckboxes(initialRoveHomeCheckboxes); setSwitchers(initialSwitchers); @@ -175,6 +193,15 @@ const SearchFiltersModal = () => { ))}
+
+ {viewCheckboxes.map((checkbox) => ( + + ))} +

195 apartments found

-

- Rove Home -

+

Rove Home

{roveHomeTypeCheckboxes.map((checkbox) => ( {
-

- Apartment type -

+

Apartment type

{apartmentTypeCheckboxes.map((checkbox) => ( { {multirangeSliders.map((slider) => (
-

- {slider.title} -

-

- {slider.unit} -

+

{slider.title}

+

{slider.unit}

{
))}
+
+

Views

+
+ {viewCheckboxes.map((checkbox) => ( + + ))} +
+
diff --git a/src/components/searchParticularApartmentsPage/ApartmentCard.tsx b/src/components/searchParticularApartmentsPage/ApartmentCard.tsx index f9814bd..344db70 100644 --- a/src/components/searchParticularApartmentsPage/ApartmentCard.tsx +++ b/src/components/searchParticularApartmentsPage/ApartmentCard.tsx @@ -9,10 +9,10 @@ const ApartmentCard = () => { }; return (
-
+

Rove Home Marasi Drive @@ -31,9 +31,15 @@ const ApartmentCard = () => { isCircleRounded />

-
+
+
+

Studio Flex, 607,08 Sqft

+

+ AED 1,668,888 +

+
); }; diff --git a/src/components/searchParticularApartmentsPage/ApartmentSidebar.tsx b/src/components/searchParticularApartmentsPage/ApartmentSidebar.tsx index ca79a72..dca12e9 100644 --- a/src/components/searchParticularApartmentsPage/ApartmentSidebar.tsx +++ b/src/components/searchParticularApartmentsPage/ApartmentSidebar.tsx @@ -11,7 +11,7 @@ const ApartmentSidebar = () => { return (
-
+
-
-

- Rove Home Marasi Drive -

-
-

- East Wing -

-
-

- Floor 11-35 -

+
+
+
+
+

+ Rove Home Marasi Drive +

+
+ 234 units +
+
+
+

+ East Wing +

+
+

+ Floor 11-35 +

+
+

+ AED 1668888 +

+
+
+ +
-

- AED 1668888 -

-
-
-
diff --git a/src/store/useSearchFilters.ts b/src/store/useSearchFilters.ts index b92fe96..b01967d 100644 --- a/src/store/useSearchFilters.ts +++ b/src/store/useSearchFilters.ts @@ -8,10 +8,13 @@ import { } from "../consts/initialSearchFilters"; import { IMultirangeSlider } from "../types/multirangeSlider"; import { ISwitcher } from "../types/switcher"; +import { initialViewCheckboxes } from "../consts/initialMasterplanFilters"; interface Store { apartmentTypeCheckboxes: ICheckbox[]; + viewCheckboxes: ICheckbox[]; setApartmentTypeCheckboxes: (typeCheckboxes: ICheckbox[]) => void; + setViewCheckboxes: (checkboxes: ICheckbox[]) => void; roveHomeTypeCheckboxes: ICheckbox[]; setRoveHomeTypeCheckboxes: (typeCheckboxes: ICheckbox[]) => void; multirangeSliders: IMultirangeSlider[]; @@ -22,8 +25,11 @@ interface Store { const useSearchFilters = create((set) => ({ apartmentTypeCheckboxes: initialApartmentTypeCheckboxes, + viewCheckboxes: initialViewCheckboxes, setApartmentTypeCheckboxes: (typeCheckboxes) => set(() => ({ apartmentTypeCheckboxes: typeCheckboxes })), + setViewCheckboxes: (typeCheckboxes) => + set(() => ({ viewCheckboxes: typeCheckboxes })), roveHomeTypeCheckboxes: initialRoveHomeCheckboxes, setRoveHomeTypeCheckboxes: (typeCheckboxes) => set(() => ({ roveHomeTypeCheckboxes: typeCheckboxes })),