diff --git a/apps/edr-freight-web/backoffice/src/lib/utils.ts b/apps/edr-freight-web/backoffice/src/lib/utils.ts index a5ef19350..54bb0325d 100644 --- a/apps/edr-freight-web/backoffice/src/lib/utils.ts +++ b/apps/edr-freight-web/backoffice/src/lib/utils.ts @@ -4,3 +4,17 @@ import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } + +/** Human label for a trade direction — DOMESTIC reads "Intercity" everywhere. */ +export function directionLabel(direction?: string | null): string { + switch (direction) { + case "IMPORT": + return "Import"; + case "EXPORT": + return "Export"; + case "DOMESTIC": + return "Intercity"; + default: + return direction || "—"; + } +} diff --git a/apps/edr-freight-web/backoffice/src/pages/contracts/ClearanceDocumentsPage.tsx b/apps/edr-freight-web/backoffice/src/pages/contracts/ClearanceDocumentsPage.tsx index 945d142df..60d5a56f8 100644 --- a/apps/edr-freight-web/backoffice/src/pages/contracts/ClearanceDocumentsPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/contracts/ClearanceDocumentsPage.tsx @@ -1,3 +1,4 @@ +import { directionLabel } from "@/lib/utils"; import { ActionIcon, Box, @@ -199,7 +200,7 @@ export default function ClearanceDocumentsPage() { variant="outline" className="h-5 border-border/50 bg-background/50 px-1.5 text-[10px] font-medium uppercase backdrop-blur-sm" > - {c.tradeDirection} + {directionLabel(c.tradeDirection)} - {direction} + {directionLabel(direction)} {customs ? ( - {contract.tradeDirection} + {directionLabel(contract.tradeDirection)} {contract.freightType} diff --git a/apps/edr-freight-web/backoffice/src/pages/contracts/ContractRequestsPage.tsx b/apps/edr-freight-web/backoffice/src/pages/contracts/ContractRequestsPage.tsx index 1752aa7c0..7687b62f0 100644 --- a/apps/edr-freight-web/backoffice/src/pages/contracts/ContractRequestsPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/contracts/ContractRequestsPage.tsx @@ -1,3 +1,4 @@ +import { directionLabel } from "@/lib/utils"; import { ActionIcon, Box, @@ -299,7 +300,7 @@ export default function ContractRequestsPage() { variant="outline" className="h-5 border-border/50 bg-background/50 px-1.5 text-[10px] font-medium uppercase backdrop-blur-sm" > - {c.tradeDirection} + {directionLabel(c.tradeDirection)} - {data.tradeDirection} + {directionLabel(data.tradeDirection)} } action={ diff --git a/apps/edr-freight-web/backoffice/src/pages/contracts/GlDjiboutiClearanceListPage.tsx b/apps/edr-freight-web/backoffice/src/pages/contracts/GlDjiboutiClearanceListPage.tsx index a43a6ff55..c5c424e9a 100644 --- a/apps/edr-freight-web/backoffice/src/pages/contracts/GlDjiboutiClearanceListPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/contracts/GlDjiboutiClearanceListPage.tsx @@ -1,3 +1,4 @@ +import { directionLabel } from "@/lib/utils"; import { useCallback, useMemo, useState } from "react"; import { useNavigate } from "react-router-dom"; import { @@ -249,7 +250,7 @@ function toContractRow(c: Freight.IContract): ContractRow { function DirectionIcon({ direction }: { direction: string }) { const isImport = direction === "IMPORT"; const Icon = isImport ? Truck : ShipWheel; - const label = isImport ? "Import" : direction === "EXPORT" ? "Export" : "—"; + const label = directionLabel(direction); return (