mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 19:00:55 +00:00
changes
This commit is contained in:
@@ -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 || "—";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="secondary"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { directionLabel } from "@/lib/utils";
|
||||
import { useMemo } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useLocation, useParams } from "react-router-dom";
|
||||
@@ -468,7 +469,7 @@ function ClearanceHero({
|
||||
color={direction === "IMPORT" ? "edr-green" : "gray"}
|
||||
radius="sm"
|
||||
>
|
||||
{direction}
|
||||
{directionLabel(direction)}
|
||||
</Badge>
|
||||
{customs ? (
|
||||
<Badge
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { directionLabel } from "@/lib/utils";
|
||||
import {
|
||||
Fragment,
|
||||
useCallback,
|
||||
@@ -180,7 +181,7 @@ function CustomsBadge({ customs }: { customs: boolean }) {
|
||||
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 (
|
||||
<Tooltip label={label} withArrow>
|
||||
<ThemeIcon
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { directionLabel } from "@/lib/utils";
|
||||
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
@@ -597,7 +598,7 @@ export default function ContractRequestDetailPage() {
|
||||
<SectionCard icon={Package} title="Cargo scope">
|
||||
<Group gap="sm" mb="md">
|
||||
<Badge variant="light" color="gray" radius="sm" tt="uppercase">
|
||||
{contract.tradeDirection}
|
||||
{directionLabel(contract.tradeDirection)}
|
||||
</Badge>
|
||||
<Badge variant="light" color="gray" radius="sm" tt="uppercase">
|
||||
{contract.freightType}
|
||||
|
||||
@@ -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)}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="secondary"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { directionLabel } from "@/lib/utils";
|
||||
import { useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useParams } from "react-router-dom";
|
||||
@@ -173,7 +174,7 @@ export default function GlClearanceDetailPage() {
|
||||
]}
|
||||
meta={
|
||||
<Badge variant="light" color={isImport ? "edr-green" : "gray"} radius="sm">
|
||||
{data.tradeDirection}
|
||||
{directionLabel(data.tradeDirection)}
|
||||
</Badge>
|
||||
}
|
||||
action={
|
||||
|
||||
@@ -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 (
|
||||
<Tooltip label={label} withArrow>
|
||||
<ThemeIcon
|
||||
|
||||
Reference in New Issue
Block a user