// Pieces shared by the case pages and the places people open cases from. import Link from "next/link"; import { ActionForm, SubmitButton } from "@/components/forms"; import { Tag } from "@/components/status"; import { Input } from "@/components/ui/input"; import { report } from "@/app/console/cases/actions"; export const caseKinds: Record = { report: "Report", "rating-review": "Rating review", "removal-request": "Removal request", "catalog-deletion": "Catalog deletion", appeal: "Appeal", }; /** What resolving each kind of case does (its button). */ export const resolveLabel: Record = { report: "Resolve", "rating-review": "Lower to general", "removal-request": "Remove the product", "catalog-deletion": "Delete the catalog", appeal: "Uphold the appeal", }; export function CaseStatus({ status }: { status: string }) { if (status === "open") return Open; if (status === "resolved") return Resolved; return Declined; } const tagLinks: Record string> = { catalog: (id) => `/catalogs/${id}`, product: (id) => `/products/${id}`, }; /** What a case is about, linked. */ export function CaseAbout({ tags, names }: { tags: Record; names: Record }) { const parts = Object.entries(tags).filter((e): e is [string, string] => !!e[1]); if (parts.length === 0) return nothing; return ( {parts.map(([kind, id]) => { const href = tagLinks[kind]?.(id); return ( {kind} {href ? ( {names[id] ?? id} ) : ( (names[id] ?? id) )} ); })} ); } /** "Report": a reason, sent to moderators (and the hosting catalogs' teams, for products). */ export function ReportForm({ about, id, label = "Report" }: { about: "product" | "catalog" | "room" | "person"; id: string; label?: string }) { return (
{label}
Send report
); }