page.tsx98 lines, 2.9 KB
| 1 | import { Button } from "@/components/ui/button"; |
| 2 | import { |
| 3 | Card, |
| 4 | CardContent, |
| 5 | CardDescription, |
| 6 | CardHeader, |
| 7 | CardTitle, |
| 8 | } from "@/components/ui/card"; |
| 9 | import { |
| 10 | AlertTriangle, |
| 11 | ArrowRight, |
| 12 | Database, |
| 13 | Link2Icon, |
| 14 | Users, |
| 15 | } from "lucide-react"; |
| 16 | import { Metadata } from "next"; |
| 17 | import Link from "next/link"; |
| 18 | |
| 19 | export const metadata: Metadata = { |
| 20 | title: "Admin Dashboard | ShirtLink", |
| 21 | description: "Admin dashboard for ShirtLink", |
| 22 | }; |
| 23 | |
| 24 | export default function AdminPage() { |
| 25 | const adminModules = [ |
| 26 | { |
| 27 | title: "URL Management", |
| 28 | description: "View, edit, and manage all shortened URLs", |
| 29 | icon: <Link2Icon className="size-5" />, |
| 30 | href: "/admin/urls", |
| 31 | color: "text-blue-500", |
| 32 | bgColor: "bg-blue-100 dark:bg-blue-900/20", |
| 33 | }, |
| 34 | { |
| 35 | title: "Flagged URLs", |
| 36 | description: "Review and moderate flagged URLs", |
| 37 | icon: <AlertTriangle className="size-5" />, |
| 38 | href: "/admin/urls/flagged", |
| 39 | color: "text-yellow-500", |
| 40 | bgColor: "bg-yellow-100 dark:bg-yellow-900/20", |
| 41 | }, |
| 42 | { |
| 43 | title: "User Management", |
| 44 | description: "Manage user accounts and permissions", |
| 45 | icon: <Users className="size-5" />, |
| 46 | href: "/admin/users", |
| 47 | color: "text-indigo-500", |
| 48 | bgColor: "bg-indigo-100 dark:bg-indigo-900/20", |
| 49 | }, |
| 50 | { |
| 51 | title: "Database Management", |
| 52 | description: "Seed and manage database data", |
| 53 | icon: <Database className="size-5" />, |
| 54 | href: "/admin/database", |
| 55 | color: "text-purple-500", |
| 56 | bgColor: "bg-purple-100 dark:bg-purple-900/20", |
| 57 | }, |
| 58 | ]; |
| 59 | |
| 60 | return ( |
| 61 | <> |
| 62 | <div className="flex items-center justify-between mb-6"> |
| 63 | <h1 className="text-3xl font-bold tracking-tight">Admin Dashboard</h1> |
| 64 | </div> |
| 65 | |
| 66 | <div className="grid gap-6"> |
| 67 | <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3"> |
| 68 | {adminModules.map((module) => ( |
| 69 | <Card key={module.href} className="overflow-hidden"> |
| 70 | <CardHeader className="pb-2"> |
| 71 | <div className="flex items-center gap-2"> |
| 72 | <div |
| 73 | className={`p-2 rounded-md ${module.bgColor} ${module.color}`} |
| 74 | > |
| 75 | {module.icon} |
| 76 | </div> |
| 77 | <CardTitle className="text-xl">{module.title}</CardTitle> |
| 78 | </div> |
| 79 | <CardDescription>{module.description}</CardDescription> |
| 80 | </CardHeader> |
| 81 | <CardContent> |
| 82 | <Link href={module.href}> |
| 83 | <Button |
| 84 | variant={"outline"} |
| 85 | className="w-full justify-between group" |
| 86 | > |
| 87 | Go to {module.title} |
| 88 | <ArrowRight className="size-4 transition-transform group-hover:translate-x-1" /> |
| 89 | </Button> |
| 90 | </Link> |
| 91 | </CardContent> |
| 92 | </Card> |
| 93 | ))} |
| 94 | </div> |
| 95 | </div> |
| 96 | </> |
| 97 | ); |
| 98 | } |