mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 15:18:11 +00:00
fix
This commit is contained in:
@@ -42,6 +42,13 @@ const arrow = (from?: string | null, to?: string | null) =>
|
||||
`${from ?? "—"} → ${to ?? "—"}`;
|
||||
|
||||
function describe(e: FleetHistoryEvent, entity: "driver" | "vehicle") {
|
||||
const bookingRef =
|
||||
typeof e.metadata?.bookingRef === "string" ? e.metadata.bookingRef : null;
|
||||
const withBooking = (rest?: string) =>
|
||||
[bookingRef ? `Booking ${bookingRef}` : "", rest ?? ""]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
switch (e.eventType) {
|
||||
case "DRIVER_REGISTERED":
|
||||
return {
|
||||
@@ -89,19 +96,19 @@ function describe(e: FleetHistoryEvent, entity: "driver" | "vehicle") {
|
||||
return {
|
||||
icon: <Route size={14} />,
|
||||
title: `${mileLabel(e)}: vehicle assigned`,
|
||||
text: e.label ? `Status: ${e.label}` : "",
|
||||
text: withBooking(e.label ? `Status: ${e.label}` : ""),
|
||||
};
|
||||
case "MILE_VEHICLE_RELEASED":
|
||||
return {
|
||||
icon: <Route size={14} />,
|
||||
title: `${mileLabel(e)}: vehicle released`,
|
||||
text: "",
|
||||
text: withBooking(),
|
||||
};
|
||||
case "MILE_STATUS_CHANGED":
|
||||
return {
|
||||
icon: <Route size={14} />,
|
||||
title: `${mileLabel(e)} status`,
|
||||
text: arrow(e.fromValue, e.toValue),
|
||||
text: withBooking(arrow(e.fromValue, e.toValue)),
|
||||
};
|
||||
default:
|
||||
return { icon: <CircleDot size={14} />, title: e.eventType, text: "" };
|
||||
|
||||
Reference in New Issue
Block a user