wing + filter
This commit is contained in:
+141
-146
@@ -5,146 +5,146 @@ import Footer from "../components/Footer";
|
||||
import TrashIcon from "../components/icons/TrashIcon";
|
||||
import SortButton from "../components/searchPage/SortButton";
|
||||
import { initialSortList } from "../consts/initialMasterplanFilters";
|
||||
import { ILayoutCard } from "../types/layoutCard";
|
||||
import Switch from "../components/Switch";
|
||||
import { ISwitcher } from "../types/switcher";
|
||||
import FavoritesSlider from "../components/favoritesPage/FavoriteSlider";
|
||||
import FavoriteCardList from "../components/favoritesPage/FavoriteCardList";
|
||||
import useFavorites from "../store/useFavorites";
|
||||
|
||||
const favoriteCards: ILayoutCard[] = [
|
||||
{
|
||||
id: "1",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "Studio Flex",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 10488888,
|
||||
square: 619,
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 619,
|
||||
},
|
||||
{
|
||||
id: "3",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "4",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1138888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "5",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "Studio Flex",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 10488888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "6",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "8",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1138888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "9",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "Studio Flex",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 10488888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "10",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "11",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1668888,
|
||||
square: 609,
|
||||
},
|
||||
{
|
||||
id: "12",
|
||||
roveHome: "Marasi Drive",
|
||||
apartmentType: "1 Bedroom",
|
||||
wing: "East Wing",
|
||||
floorStart: 11,
|
||||
floorEnd: 35,
|
||||
units: 234,
|
||||
cost: 1138888,
|
||||
square: 609,
|
||||
},
|
||||
];
|
||||
// const favoriteCards: ILayoutCard[] = [
|
||||
// {
|
||||
// id: "1",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "Studio Flex",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 10488888,
|
||||
// square: 619,
|
||||
// },
|
||||
// {
|
||||
// id: "2",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 619,
|
||||
// },
|
||||
// {
|
||||
// id: "3",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "4",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1138888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "5",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "Studio Flex",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 10488888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "6",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "7",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "8",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1138888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "9",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "Studio Flex",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 10488888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "10",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "11",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1668888,
|
||||
// square: 609,
|
||||
// },
|
||||
// {
|
||||
// id: "12",
|
||||
// roveHome: "Marasi Drive",
|
||||
// apartmentType: "1 Bedroom",
|
||||
// wing: "East Wing",
|
||||
// floorStart: 11,
|
||||
// floorEnd: 35,
|
||||
// units: 234,
|
||||
// cost: 1138888,
|
||||
// square: 609,
|
||||
// },
|
||||
// ];
|
||||
|
||||
const initialCollectionCompareSwitcher: ISwitcher = {
|
||||
id: "1",
|
||||
@@ -154,9 +154,8 @@ const initialCollectionCompareSwitcher: ISwitcher = {
|
||||
|
||||
const Favorites = () => {
|
||||
const [sortList, setSortList] = useState(initialSortList);
|
||||
// const [cards, setCards] = useState<ILayoutCard[]>([]);
|
||||
const [cards, setCards] = useState(favoriteCards);
|
||||
const [switcher, setSwitcher] = useState(initialCollectionCompareSwitcher);
|
||||
const { favorites, setFavorites } = useFavorites();
|
||||
|
||||
const handleOnSortClick = (sortId: string) => {
|
||||
const updatedSortList = sortList.map((sort) => {
|
||||
@@ -174,7 +173,7 @@ const Favorites = () => {
|
||||
|
||||
const handleOnDeleteFavoriteClick = () => {
|
||||
localStorage.removeItem("Favorites");
|
||||
setCards([]);
|
||||
setFavorites([]);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -182,9 +181,9 @@ const Favorites = () => {
|
||||
if (favoriteCards) {
|
||||
const convertedCards = JSON.parse(favoriteCards);
|
||||
const sortedCards = sortCardBy(sortList, convertedCards);
|
||||
setCards(sortedCards);
|
||||
setFavorites(sortedCards);
|
||||
}
|
||||
}, [sortList]);
|
||||
}, [setFavorites, sortList]);
|
||||
|
||||
return (
|
||||
<div className="overflow-scroll h-screen w-screen pt-14">
|
||||
@@ -194,7 +193,7 @@ const Favorites = () => {
|
||||
<div className="flex items-center gap-8">
|
||||
<div className="flex gap-4 font-semibold text-subheadline-s leading-7 py-[6px]">
|
||||
<h2 className="text-[#0D1922]">Units</h2>
|
||||
<p className="text-[#73787C]">{cards.length}</p>
|
||||
<p className="text-[#73787C]">{favorites.length}</p>
|
||||
</div>
|
||||
<SortButton sortList={sortList} onClick={handleOnSortClick} />
|
||||
</div>
|
||||
@@ -228,11 +227,7 @@ const Favorites = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{switcher.isSwitched ? (
|
||||
<FavoritesSlider cards={cards} />
|
||||
) : (
|
||||
<FavoriteCardList cards={cards} />
|
||||
)}
|
||||
{switcher.isSwitched ? <FavoritesSlider /> : <FavoriteCardList />}
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user