51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
import { CheckCircle2 } from 'lucide-react';
|
|
import { WishCard } from '@/components/WishCard/WishCard';
|
|
import {
|
|
useDeleteWish,
|
|
useDuplicateWish,
|
|
useWishes,
|
|
} from '@/features/wishes/wishes.hooks';
|
|
|
|
export function CompletedPage() {
|
|
const { data, isLoading } = useWishes('completed');
|
|
const duplicate = useDuplicateWish();
|
|
const remove = useDeleteWish();
|
|
|
|
return (
|
|
<div className="grid gap-6">
|
|
<section>
|
|
<h1 className="font-display text-3xl">Fulfilled</h1>
|
|
<p className="text-sm text-muted">
|
|
Wishes you've received. You can create a new wish based on any of them.
|
|
</p>
|
|
</section>
|
|
|
|
{isLoading && <div className="text-muted">Loading...</div>}
|
|
|
|
{!isLoading && data && data.length === 0 && (
|
|
<div className="flex flex-col items-center gap-2 rounded-xl border border-border bg-surface/80 p-10 text-center shadow-card">
|
|
<CheckCircle2 className="h-10 w-10 text-muted" />
|
|
<h2 className="text-xl font-semibold">Nothing fulfilled yet</h2>
|
|
<p className="text-sm text-muted">
|
|
When a wish comes true, mark it as fulfilled and it lands here.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
{data && data.length > 0 && (
|
|
<div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
|
{data.map((wish) => (
|
|
<WishCard
|
|
key={wish.id}
|
|
wish={wish}
|
|
view="owner"
|
|
onDuplicate={() => duplicate.mutate(wish.id)}
|
|
onDelete={() => remove.mutate(wish.id)}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|