From 4cfa0418dd0a0a5df20e4397be8793a2e6c7a68b Mon Sep 17 00:00:00 2001 From: okbel Date: Thu, 18 Feb 2021 13:11:57 -0300 Subject: [PATCH] Adding wishlist api --- .../HomeAllProductsGrid/HomeAllProductsGrid.tsx | 12 ++++++++++-- components/common/UserNav/UserNav.tsx | 4 ++-- pages/search.tsx | 16 ++++++++++++++-- pages/wishlist.tsx | 4 ++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx b/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx index 49e115df6..4b838e1a4 100644 --- a/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx +++ b/components/common/HomeAllProductsGrid/HomeAllProductsGrid.tsx @@ -5,14 +5,21 @@ import { Grid } from '@components/ui' import { ProductCard } from '@components/product' import s from './HomeAllProductsGrid.module.css' import { getCategoryPath, getDesignerPath } from '@lib/search' +import wishlist from '@framework/api/wishlist' interface Props { categories?: any brands?: any products?: Product[] + wishlist?: boolean } -const Head: FC = ({ categories, brands, products = [] }) => { +const HomeAllProductsGrid: FC = ({ + categories, + brands, + products = [], + wishlist = false, +}) => { return (
@@ -58,6 +65,7 @@ const Head: FC = ({ categories, brands, products = [] }) => { width: 480, height: 480, }} + wishlist={wishlist} /> ))} @@ -66,4 +74,4 @@ const Head: FC = ({ categories, brands, products = [] }) => { ) } -export default Head +export default HomeAllProductsGrid diff --git a/components/common/UserNav/UserNav.tsx b/components/common/UserNav/UserNav.tsx index 19151c38b..ab8021063 100644 --- a/components/common/UserNav/UserNav.tsx +++ b/components/common/UserNav/UserNav.tsx @@ -9,20 +9,20 @@ import { useUI } from '@components/ui/context' import DropdownMenu from './DropdownMenu' import s from './UserNav.module.css' import { Avatar } from '@components/common' -import frameworkConfig from '@framework/config.json' +import Features from '@commerce/utils/features' interface Props { className?: string } const countItem = (count: number, item: LineItem) => count + item.quantity +const isWishlistEnabled = Features.isEnabled('wishlist') const UserNav: FC = ({ className }) => { const { data } = useCart() const { data: customer } = useCustomer() const { toggleSidebar, closeSidebarIfPresent, openModal } = useUI() const itemsCount = data?.lineItems.reduce(countItem, 0) ?? 0 - const isWishlistEnabled = !!frameworkConfig.features.wishlist return (