import { Badge, Group } from "@mantine/core"; import { Building2, Repeat, UserRound } from "lucide-react"; import { CONTRACT_STATUS_COLOR, CONTRACT_STATUS_STYLES, contractCourt, } from "@/features/contracts/contract-status.config"; interface ContractStatusBadgeProps { status: string; /** When the contract is a renewal of a prior one, show a sibling badge. */ isRenewal?: boolean; } export function ContractStatusBadge({ status, isRenewal, }: ContractStatusBadgeProps) { const style = CONTRACT_STATUS_STYLES[status] ?? { label: status, color: "gray", }; const color = CONTRACT_STATUS_COLOR[status] ?? "gray"; const statusBadge = ( {style.label} ); if (!isRenewal) return statusBadge; return ( {statusBadge} } title="Renewal of a prior contract" style={{ fontSize: "0.7rem", letterSpacing: "0.05em", display: "inline-flex", whiteSpace: "nowrap", }} > Renewal ); } /** Whose court the contract sits in: customer, EDR, or nobody ("—"). */ export function ContractCourtBadge({ status }: { status: string }) { const court = contractCourt(status); if (!court) { return ( ); } const isCustomer = court === "customer"; return ( : } title={ isCustomer ? "Waiting on the customer to act" : "Waiting on EDR staff to act" } style={{ fontSize: "0.7rem", letterSpacing: "0.05em", display: "inline-flex", whiteSpace: "nowrap", }} > {isCustomer ? "With customer" : "With EDR"} ); }