| 1 | "use client"; |
| 2 | |
| 3 | import { motion } from "framer-motion"; |
| 4 | import { Inbox } from "lucide-react"; |
| 5 | import { DropCard } from "@/components/dashboard/DropCard"; |
| 6 | import { EmptyState } from "@/components/shared/EmptyState"; |
| 7 | import { Skeleton } from "@/components/ui/skeleton"; |
| 8 | import { useRecentDrops } from "@/hooks/useDrops"; |
| 9 | import { staggerContainer, fadeUpItem } from "@/lib/motion"; |
| 10 | |
| 11 | export default function DropsPage() { |
| 12 | const { data, isLoading } = useRecentDrops(60); |
| 13 | const drops = data?.data ?? []; |
| 14 | |
| 15 | return ( |
| 16 | <div className="mx-auto max-w-[1100px] space-y-5"> |
| 17 | <div> |
| 18 | <h2 className="text-lg font-semibold tracking-[var(--tracking-tight)]">Live Drops</h2> |
| 19 | <p className="mt-0.5 text-sm text-[var(--color-fg-tertiary)]"> |
| 20 | Everything DropHawk has caught, newest first. |
| 21 | </p> |
| 22 | </div> |
| 23 | |
| 24 | {isLoading ? ( |
| 25 | <div className="grid grid-cols-1 gap-3 md:grid-cols-2"> |
| 26 | {Array.from({ length: 6 }).map((_, i) => ( |
| 27 | <Skeleton key={i} className="h-[148px] rounded-[var(--radius-lg)]" /> |
| 28 | ))} |
| 29 | </div> |
| 30 | ) : drops.length === 0 ? ( |
| 31 | <EmptyState |
| 32 | icon={Inbox} |
| 33 | title="No drops yet" |
| 34 | description="As soon as a tracked event changes state, it shows up here." |
| 35 | /> |
| 36 | ) : ( |
| 37 | <motion.div |
| 38 | variants={staggerContainer} |
| 39 | initial="initial" |
| 40 | animate="animate" |
| 41 | className="grid grid-cols-1 gap-3 md:grid-cols-2" |
| 42 | > |
| 43 | {drops.map((drop) => ( |
| 44 | <motion.div key={drop.id} variants={fadeUpItem}> |
| 45 | <DropCard drop={drop} /> |
| 46 | </motion.div> |
| 47 | ))} |
| 48 | </motion.div> |
| 49 | )} |
| 50 | </div> |
| 51 | ); |
| 52 | } |