import { useState } from 'react'; import { Plus, Sparkles } from 'lucide-react'; import type { Wish } from '@family-wishlist/shared'; import { Button } from '@/components/ui/Button'; import { WishCard } from '@/components/WishCard/WishCard'; import { WishForm } from '@/components/WishForm/WishForm'; import { useArchiveWish, useCompleteWish, useDeleteWish, useWishes, } from '@/features/wishes/wishes.hooks'; import { useAuthStore } from '@/features/auth/authStore'; import { Link } from 'react-router-dom'; export function DashboardPage() { const { data, isLoading } = useWishes('active'); const [creating, setCreating] = useState(false); const [editing, setEditing] = useState(null); const archive = useArchiveWish(); const complete = useCompleteWish(); const remove = useDeleteWish(); const user = useAuthStore((s) => s.user); return (

Your wishlist

Add things you dream of. Share your public page at{' '} {user && ( /u/{user.slug} )} .

{isLoading && (
{[0, 1, 2].map((i) => (
))}
)} {!isLoading && data && data.length === 0 && (

No wishes yet

Start by adding something you'd love to receive.

)} {!isLoading && data && data.length > 0 && (
{data.map((wish) => ( setEditing(wish)} onArchive={() => archive.mutate(wish.id)} onComplete={() => complete.mutate(wish.id)} onDelete={() => remove.mutate(wish.id)} /> ))}
)} setCreating(false)} /> setEditing(null)} />
); }