'use client'; import { Link, SmartLink } from '@/core/lib/navigation'; import { useWishlistPage } from '@/core/hooks/use-wishlist-page'; import { ProductGrid } from '@/ui/product/product-grid'; import { Skeleton } from '@/components/ui/skeleton'; import { useTranslations } from '@/core/lib/translations'; /** * The wishlist page (bare skeleton): the shopper's saved products, newest first. * * `status` decides what to draw, exactly like the cart page: * loading a skeleton, never a spinner and never the empty state * error the list could not be loaded: say so and offer `retry`. NEVER draw it as empty * empty the ONLY state that says "nothing saved yet" * ready the products (ProductGrid; each card keeps its heart, which removes it here) * * Keep: the guest line (a guest's list lives in this browser only) and the * `role="status"` result region of "add all to cart" (`{ added, skipped }`). */ export function WishlistView() { const t = useTranslations('wishlist'); const { status, products, isMember, retry, canAddToCart, addAllToCart, addingAll, addAllResult, dismissAddAllResult, } = useWishlistPage(); if (status === 'loading') { return (
{/* DESIGN ME — wishlist loading skeleton (a few product-card-shaped blocks). */}
); } if (status === 'error') { return (
{/* DESIGN ME — wishlist load-error state: the list could not be loaded, so do NOT draw it as empty. */}

{t('loadErrorTitle')}

{t('loadErrorBody')}

); } if (status === 'empty') { return (
{/* DESIGN ME — wishlist empty state: nothing saved yet. */}

{t('emptyTitle')}

{t('emptySubtitle')}

{t('browseProducts')}
); } const anyAvailable = products.some(canAddToCart); const resultText = addAllResult ? addAllResult.added === 0 ? t('addAllNone') : addAllResult.skipped === 0 ? t('addAllDone', { added: String(addAllResult.added) }) : t(addAllResult.skipped === 1 ? 'addAllDoneSkippedOne' : 'addAllDoneSkippedOther', { added: String(addAllResult.added), skipped: String(addAllResult.skipped), }) : ''; return (
{/* DESIGN ME — wishlist page (ready): title + count, the guest line, "add all to cart", then the product grid. Data comes from useWishlistPage(). Compose with the shadcn/ui primitives in src/components/ui (Button, Card, Badge, Skeleton, ...) + lucide-react icons. */}

{t('title')}

{products.length === 1 ? t('itemCountOne') : t('itemCountOther', { count: String(products.length) })}

{/* A guest's list lives in this browser. Said once, in a line, never in the way. */} {!isMember && (

{t('guestNote')} {t('guestLogin')}

)}
{resultText && (

{resultText}{' '}

)}
); }