infiniti scroll product list

This commit is contained in:
hamid zarghami
2025-09-06 15:09:58 +03:30
parent 0f77a3208d
commit 5ec2b621bc
5 changed files with 122 additions and 19 deletions
+3
View File
@@ -4,6 +4,7 @@ import { Heart } from 'iconsax-react'
import Image from 'next/image'
import { FC, useState } from 'react'
import { useAddWishlist, useRemoveWishlist } from '@/app/products/hooks/useProductsData'
import { useSharedStore } from '@/share/store/sharedStore'
type Props = {
item?: IProduct
@@ -12,6 +13,7 @@ type Props = {
const ProductCard: FC<Props> = ({ item }) => {
const { isLogin } = useSharedStore()
const [isWished, setIsWished] = useState(item?.isWishlist)
const { mutate: addWishlist } = useAddWishlist()
@@ -19,6 +21,7 @@ const ProductCard: FC<Props> = ({ item }) => {
const handleWish = () => {
if (!isLogin) return
if (!item?._id || !item?.variants[0]?._id) return
if (isWished) {