diff --git a/app/favicon.ico b/app/favicon.ico index 4f8a400..30f2745 100644 Binary files a/app/favicon.ico and b/app/favicon.ico differ diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index ffbd266..fe1a128 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -67,7 +67,7 @@ export default function Header({ locale = "ru" }: HeaderProps) { src={Logo} alt="Logo" fill - className="object-contain" + className="object-contain mt-2" priority /> diff --git a/features/cart/components/CartItemCard.tsx b/features/cart/components/CartItemCard.tsx index 5b60cbc..7f16b31 100644 --- a/features/cart/components/CartItemCard.tsx +++ b/features/cart/components/CartItemCard.tsx @@ -289,13 +289,12 @@ export default function CartItemCard({ item, onUpdate }: CartItemCardProps) { className="object-contain p-2" /> - -
-

- {item.product.name} -

- {/*
+

+ {item.product.name} +

+ {/*

@@ -321,16 +320,16 @@ export default function CartItemCard({ item, onUpdate }: CartItemCardProps) {

)} */} - -
+ +
{/* Price & Quantity */}
@@ -396,15 +395,15 @@ export default function CartItemCard({ item, onUpdate }: CartItemCardProps) { variant="outline" size="icon" onClick={handleQuantityIncrease} - disabled={isSyncing || localQuantity >= availableStock} + disabled={isSyncing} className={`rounded-[10px] h-10 w-10 cursor-pointer border-2 transition-all duration-200 ${ localQuantity >= availableStock - ? "opacity-30 cursor-not-allowed border-gray-200" + ? "opacity-60 border-gray-200" : "border-gray-900 bg-gray-900 hover:bg-gray-800" } ${isSyncing ? "opacity-50" : ""}`} > = availableStock ? "text-gray-400" : "text-white"}`} + className={`h-4 w-4 ${localQuantity >= availableStock ? "text-gray-900" : "text-white"}`} />
diff --git a/features/home/components/ProductCard.tsx b/features/home/components/ProductCard.tsx index 3b1241f..e18c99a 100644 --- a/features/home/components/ProductCard.tsx +++ b/features/home/components/ProductCard.tsx @@ -33,6 +33,7 @@ import { useToggleFavorite, useIsFavorite } from "@/lib/hooks"; import { useAddToCart, useUpdateCartItemQuantity, + useRemoveFromCart, useCart, } from "@/features/cart/hooks/useCart"; import { useTranslations } from "next-intl"; @@ -73,6 +74,7 @@ export default function ProductCard({ useToggleFavorite(); const addToCartMutation = useAddToCart(); const updateCartMutation = useUpdateCartItemQuantity(); + const removeFromCartMutation = useRemoveFromCart(); const { data: cartData, refetch: refetchCart } = useCart(); const [api, setApi] = useState(); @@ -91,7 +93,7 @@ export default function ProductCard({ const cartItem = cartData?.data?.find((item: any) => item.product?.id === id); const isInCart = !!cartItem; const isOutOfStock = stock === 0; - const availableStock = stock || 999; + const availableStock = stock || 0; useEffect(() => { if (!api) return; @@ -118,7 +120,11 @@ export default function ProductCard({ setIsSyncing(true); try { - await updateCartMutation.mutateAsync({ productId: id, quantity }); + if (quantity === 0) { + await removeFromCartMutation.mutateAsync(id); + } else { + await updateCartMutation.mutateAsync({ productId: id, quantity }); + } await refetchCart(); if (pendingQuantityRef.current !== null) { @@ -213,7 +219,7 @@ export default function ProductCard({ const newQuantity = localQuantity + delta; - if (newQuantity < 1) return; + if (newQuantity < 0) return; if (newQuantity > availableStock) { setShowStockModal(true); @@ -222,7 +228,7 @@ export default function ProductCard({ setLocalQuantity(newQuantity); }, - [localQuantity, availableStock], + [localQuantity, availableStock, setShowStockModal], ); const handleCardClick = useCallback( @@ -425,7 +431,7 @@ export default function ProductCard({ variant="outline" size="icon" onClick={(e) => handleQuantityChange(e, -1)} - disabled={isSyncing || localQuantity <= 1} + disabled={isSyncing} className="rounded-[10px] cursor-pointer h-7 md:h-9 w-7 md:w-9 border-2 border-gray-200 hover:border-gray-900 hover:bg-gray-50 transition-all duration-200 disabled:opacity-30" > @@ -447,9 +453,15 @@ export default function ProductCard({ size="icon" onClick={(e) => handleQuantityChange(e, 1)} disabled={isSyncing} - className="rounded-[10px] cursor-pointer h-7 md:h-9 w-7 md:w-9 border-2 border-gray-900 bg-gray-900 hover:bg-gray-800 transition-all duration-200 disabled:opacity-30" + className={`rounded-[10px] cursor-pointer h-7 md:h-9 w-7 md:w-9 border-2 transition-all duration-200 disabled:opacity-30 ${ + localQuantity >= availableStock + ? "opacity-60 border-gray-200" + : "border-gray-900 bg-gray-900 hover:bg-gray-800" + }`} > - + = availableStock ? "text-gray-900" : "text-white"}`} + />
)} diff --git a/features/home/components/ProductGrid.tsx b/features/home/components/ProductGrid.tsx index 4213013..17c0214 100644 --- a/features/home/components/ProductGrid.tsx +++ b/features/home/components/ProductGrid.tsx @@ -72,7 +72,7 @@ export default function CollectionSection({ collection, locale }: Props) { m.images_800x800 || m.images_720x720 || m.images_400x400 || - m.thumbnail + m.thumbnail, ) .filter(Boolean) || ["/placeholder-product.jpg"]; @@ -95,10 +95,11 @@ export default function CollectionSection({ collection, locale }: Props) { // height={450} // width={350} button={true} + stock={product.stock} /> ); })} ); -} \ No newline at end of file +} diff --git a/features/products/components/ProductPurchaseCard.tsx b/features/products/components/ProductPurchaseCard.tsx index 1564c08..f50ba09 100644 --- a/features/products/components/ProductPurchaseCard.tsx +++ b/features/products/components/ProductPurchaseCard.tsx @@ -111,10 +111,12 @@ export function ProductPurchaseCard({ variant="outline" size="icon" onClick={onQuantityIncrease} - disabled={isSyncing || localQuantity >= availableStock} - className={`rounded-[10px] h-12 w-12 border-2 border-gray-900 bg-gray-900 hover:bg-gray-800 transition-all duration-200 disabled:opacity-30 disabled:cursor-not-allowed ${ - isSyncing ? "opacity-50" : "" - }`} + disabled={isSyncing} + className={`rounded-[10px] h-12 w-12 border-2 border-gray-900 bg-gray-900 hover:bg-gray-800 transition-all duration-200 ${ + localQuantity >= availableStock + ? "opacity-60 border-gray-200" + : "" + } ${isSyncing ? "opacity-50" : ""}`} > diff --git a/public/logo.png b/public/logo.png index d6603d0..176c8da 100644 Binary files a/public/logo.png and b/public/logo.png differ diff --git a/public/screencapture-market-post-tm-ru-2025-05-12-15_18_42.png b/public/screencapture-market-post-tm-ru-2025-05-12-15_18_42.png deleted file mode 100644 index a508e5f..0000000 Binary files a/public/screencapture-market-post-tm-ru-2025-05-12-15_18_42.png and /dev/null differ diff --git a/public/screencapture-market-post-tm-ru-2025-05-12-15_20_20.png b/public/screencapture-market-post-tm-ru-2025-05-12-15_20_20.png deleted file mode 100644 index ccd98eb..0000000 Binary files a/public/screencapture-market-post-tm-ru-2025-05-12-15_20_20.png and /dev/null differ diff --git a/public/screencapture-market-post-tm-ru-cart-summary-2025-05-12-15_19_28.png b/public/screencapture-market-post-tm-ru-cart-summary-2025-05-12-15_19_28.png deleted file mode 100644 index d3f68f3..0000000 Binary files a/public/screencapture-market-post-tm-ru-cart-summary-2025-05-12-15_19_28.png and /dev/null differ diff --git a/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_19_05.png b/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_19_05.png deleted file mode 100644 index 5f54769..0000000 Binary files a/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_19_05.png and /dev/null differ diff --git a/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_20_56.png b/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_20_56.png deleted file mode 100644 index 40edce7..0000000 Binary files a/public/screencapture-market-post-tm-ru-category-elektronika-2025-05-12-15_20_56.png and /dev/null differ