| 1 | "use client"; |
| 2 | |
| 3 | import { motion } from "framer-motion"; |
| 4 | import { Eye } from "lucide-react"; |
| 5 | import { WatchlistForm } from "@/components/watchlist/WatchlistForm"; |
| 6 | import { WatchlistItem } from "@/components/watchlist/WatchlistItem"; |
| 7 | import { EmptyState } from "@/components/shared/EmptyState"; |
| 8 | import { Skeleton } from "@/components/ui/skeleton"; |
| 9 | import { useWatchlist } from "@/hooks/useWatchlist"; |
| 10 | import { staggerContainer } from "@/lib/motion"; |
| 11 | |
| 12 | export default function WatchlistPage() { |
| 13 | const { data, isLoading } = useWatchlist(); |
| 14 | |
| 15 | return ( |
| 16 | <div className="mx-auto max-w-3xl space-y-5"> |
| 17 | <div> |
| 18 | <h2 className="text-lg font-semibold tracking-[var(--tracking-tight)]">Watchlist</h2> |
| 19 | <p className="mt-0.5 text-sm text-[var(--color-fg-tertiary)]"> |
| 20 | Add the artists, teams, and events you care about. We alert the instant any of them drops. |
| 21 | </p> |
| 22 | </div> |
| 23 | |
| 24 | <WatchlistForm /> |
| 25 | |
| 26 | {isLoading ? ( |
| 27 | <div className="space-y-2.5"> |
| 28 | {Array.from({ length: 3 }).map((_, i) => ( |
| 29 | <Skeleton key={i} className="h-[64px] rounded-[var(--radius)]" /> |
| 30 | ))} |
| 31 | </div> |
| 32 | ) : !data || data.length === 0 ? ( |
| 33 | <EmptyState |
| 34 | icon={Eye} |
| 35 | title="Nothing tracked yet" |
| 36 | description="Add your first watch above - try “Taylor Swift” - and DropHawk starts listening across every connected source." |
| 37 | /> |
| 38 | ) : ( |
| 39 | <motion.ul variants={staggerContainer} initial="initial" animate="animate" className="space-y-2.5"> |
| 40 | {data.map((rule) => ( |
| 41 | <WatchlistItem key={rule.id} rule={rule} /> |
| 42 | ))} |
| 43 | </motion.ul> |
| 44 | )} |
| 45 | </div> |
| 46 | ); |
| 47 | } |