Connect all CRM pages to the BFF and CRM service, add module docs, and mark CRM available in the SuperApp catalog. Co-authored-by: Cursor <cursoragent@cursor.com>
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { Badge } from "@/components/ds";
|
|
import {
|
|
activityStatusLabels,
|
|
contactStatusLabels,
|
|
leadPriorityLabels,
|
|
leadStatusLabels,
|
|
opportunityStatusLabels,
|
|
organizationStatusLabels,
|
|
} from "./tokens";
|
|
|
|
type Tone = "default" | "primary" | "success" | "warning" | "danger" | "info";
|
|
|
|
const toneMap: Record<string, Tone> = {
|
|
new: "info",
|
|
contacted: "primary",
|
|
qualified: "success",
|
|
unqualified: "warning",
|
|
converted: "success",
|
|
lost: "danger",
|
|
open: "primary",
|
|
won: "success",
|
|
lost_deal: "danger",
|
|
on_hold: "warning",
|
|
planned: "default",
|
|
in_progress: "info",
|
|
completed: "success",
|
|
cancelled: "danger",
|
|
active: "success",
|
|
inactive: "default",
|
|
archived: "warning",
|
|
prospect: "info",
|
|
low: "default",
|
|
medium: "primary",
|
|
high: "warning",
|
|
urgent: "danger",
|
|
};
|
|
|
|
export function CrmStatusChip({
|
|
status,
|
|
domain = "generic",
|
|
}: {
|
|
status: string;
|
|
domain?: "lead" | "opportunity" | "activity" | "contact" | "organization" | "priority" | "generic";
|
|
}) {
|
|
const labels: Record<string, string> = {
|
|
...leadStatusLabels,
|
|
...opportunityStatusLabels,
|
|
...activityStatusLabels,
|
|
...contactStatusLabels,
|
|
...organizationStatusLabels,
|
|
...leadPriorityLabels,
|
|
};
|
|
const label = labels[status] ?? status;
|
|
const tone = toneMap[status] ?? "default";
|
|
return <Badge tone={tone}>{label}</Badge>;
|
|
}
|