mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 07:51:02 +00:00
26 lines
712 B
TypeScript
26 lines
712 B
TypeScript
import type { BuiltTrainStatus } from "@/services/trainBuilder.service";
|
|
|
|
/** Badge color per built-train lifecycle status (Mantine palette keys). */
|
|
export const trainStatusColor = (status: BuiltTrainStatus | string): string => {
|
|
switch (status) {
|
|
case "AVAILABLE":
|
|
return "edr-green";
|
|
case "SCHEDULED":
|
|
return "blue";
|
|
case "IN_SERVICE":
|
|
return "teal";
|
|
case "UNDER_MAINTENANCE":
|
|
return "yellow";
|
|
case "OUT_OF_SERVICE":
|
|
return "red";
|
|
default:
|
|
return "gray";
|
|
}
|
|
};
|
|
|
|
export const trainStatusLabel = (status: BuiltTrainStatus | string): string =>
|
|
String(status)
|
|
.toLowerCase()
|
|
.replace(/_/g, " ")
|
|
.replace(/^\w/, (c) => c.toUpperCase());
|