diff --git a/src/app/(normal)/commissions/status/page.tsx b/src/app/(normal)/commissions/status/page.tsx new file mode 100644 index 0000000..eab2daf --- /dev/null +++ b/src/app/(normal)/commissions/status/page.tsx @@ -0,0 +1,122 @@ +import { Badge } from "@/components/ui/badge"; +import { prisma } from "@/lib/prisma"; + +const statusStyles: Record = { + ACCEPTED: "bg-sky-500/15 text-sky-300 border-sky-500/30", + INPROGRESS: "bg-amber-500/15 text-amber-300 border-amber-500/30", + COMPLETED: "bg-emerald-500/15 text-emerald-300 border-emerald-500/30", +}; + +const statusLabels: Record = { + ACCEPTED: "Accepted", + INPROGRESS: "In progress", + COMPLETED: "Completed", +}; + +export default async function CommissionStatusPage() { + const [queueItems, doneItems] = await Promise.all([ + prisma.commissionRequest.findMany({ + where: { status: { in: ["ACCEPTED", "INPROGRESS"] } }, + include: { type: true, option: true, extras: true, customCard: true }, + orderBy: { createdAt: "desc" }, + }), + prisma.commissionRequest.findMany({ + where: { status: "COMPLETED" }, + include: { type: true, option: true, extras: true, customCard: true }, + orderBy: { createdAt: "desc" }, + }), + ]); + + return ( +
+
+

Commission Status

+
+ +
+
+
+

Commissions Queue

+

Accepted and in progress

+
+
+ {queueItems.length > 0 ? ( + queueItems.map((item) => ( +
+
{item.customerName}
+
+ + {item.customCard?.name ?? item.type?.name ?? "Custom"} + + + {item.option?.name ?? "Base option"} + + {item.extras.map((extra) => ( + + {extra.name} + + ))} + {item.extras.length === 0 ? ( + No extras + ) : null} + + {statusLabels[item.status] ?? item.status} + +
+
+ )) + ) : ( +
+ No public items yet. +
+ )} +
+
+ +
+
+

Done

+
+
+ {doneItems.length > 0 ? ( + doneItems.map((item) => ( +
+
{item.customerName}
+
+ + {item.customCard?.name ?? item.type?.name ?? "Custom"} + + + {item.option?.name ?? "Base option"} + + {item.extras.map((extra) => ( + + {extra.name} + + ))} + {item.extras.length === 0 ? ( + No extras + ) : null} + + {statusLabels[item.status] ?? item.status} + +
+
+ )) + ) : ( +
+ No completed items yet. +
+ )} +
+
+
+
+ ); +} diff --git a/src/components/global/TopNav.tsx b/src/components/global/TopNav.tsx index dd3b677..2e243bd 100644 --- a/src/components/global/TopNav.tsx +++ b/src/components/global/TopNav.tsx @@ -12,6 +12,7 @@ const links = [ { href: "/artworks", label: "Portfolio" }, { href: "/artworks/animalstudies", label: "Animal Studies" }, { href: "/commissions", label: "Commissions" }, + { href: "/commissions/status", label: "Commission Status" }, { href: "/tos", label: "Terms of Service" }, // { href: "/portfolio/artfight", label: "Artfight" }, // { href: "/portfolio/minis", label: "Miniatures" }, @@ -72,4 +73,4 @@ export default function TopNav() { ); -} \ No newline at end of file +}