Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { Badge } from "@/components/ds";
|
|
import { cn } from "@/lib/utils";
|
|
import { appointmentStatusTone } from "./tokens";
|
|
|
|
const statusLabels: Record<string, string> = {
|
|
requested: "درخواست",
|
|
confirmed: "تأیید شده",
|
|
checked_in: "پذیرش",
|
|
in_progress: "در حال انجام",
|
|
completed: "انجام شد",
|
|
cancelled: "لغو",
|
|
no_show: "عدم حضور",
|
|
draft: "پیشنویس",
|
|
active: "فعال",
|
|
inactive: "غیرفعال",
|
|
suspended: "معلق",
|
|
archived: "آرشیو",
|
|
available: "آزاد",
|
|
occupied: "اشغال",
|
|
maintenance: "تعمیر",
|
|
};
|
|
|
|
type Domain = "appointment" | "lifecycle" | "resource" | "generic";
|
|
|
|
export function BeautyStatusChip({
|
|
status,
|
|
domain = "generic",
|
|
className,
|
|
}: {
|
|
status: string;
|
|
domain?: Domain;
|
|
className?: string;
|
|
}) {
|
|
const tone =
|
|
domain === "appointment"
|
|
? appointmentStatusTone[status] ?? "default"
|
|
: status === "active" || status === "completed"
|
|
? "success"
|
|
: status === "cancelled"
|
|
? "danger"
|
|
: "default";
|
|
|
|
return (
|
|
<Badge tone={tone} className={cn("font-medium", className)}>
|
|
{statusLabels[status] ?? status}
|
|
</Badge>
|
|
);
|
|
}
|