Files
edr-platform/apps/edr-freight-web/backoffice/src/components/trainScheduling/ScheduleStatusBadge.tsx
2026-06-22 07:44:03 +00:00

45 lines
1.2 KiB
TypeScript

import { Badge } from "@mantine/core";
const STATUS_COLORS: Record<string, string> = {
DRAFT: "gray",
SCHEDULED: "blue",
DISPATCHED: "edr-green",
ARRIVED: "teal",
CANCELLED: "red",
};
export function ScheduleStatusBadge({ status }: { status: string }) {
return (
<Badge variant="light" color={STATUS_COLORS[status] ?? "gray"} size="sm">
{status}
</Badge>
);
}
export function FreightTypeBadge({ freightType }: { freightType?: string | null }) {
if (!freightType) return <Badge variant="light" color="gray" size="sm"></Badge>;
const color =
freightType === "BULK" ? "orange" : freightType === "MIXED" ? "grape" : "cyan";
return (
<Badge variant="light" color={color} size="sm">
{freightType}
</Badge>
);
}
export function SchedulingStatusBadge({ status }: { status?: string | null }) {
if (!status) return null;
const colors: Record<string, string> = {
NOT_SCHEDULED: "gray",
HOLDING: "yellow",
ELIGIBLE: "blue",
SCHEDULED: "indigo",
DISPATCHED: "edr-green",
};
return (
<Badge variant="light" color={colors[status] ?? "gray"} size="sm">
{status.replace(/_/g, " ")}
</Badge>
);
}