From da0f1e4cc9778c1e5bd394635e18fbe6b05a98cd Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Sat, 6 Jun 2026 09:11:13 +0300 Subject: [PATCH] feat(bookings): enhance contract viewer and backoffice UI consistency --- .../components/bookings/booking-ui.styles.ts | 11 +-- .../layout/FreightDashboardHeader.tsx | 45 +++++++-- .../layout/FreightDashboardLayout.tsx | 15 +-- .../src/components/layout/FreightSidebar.tsx | 48 +++++++--- .../pages/bookings/BookingContractPage.tsx | 27 +++--- .../src/pages/bookings/BookingDetailPage.tsx | 95 ++++++++++++++----- apps/edr-freight-web/portal/src/utils/api.ts | 29 +++--- 7 files changed, 185 insertions(+), 85 deletions(-) diff --git a/apps/edr-freight-web/backoffice/src/components/bookings/booking-ui.styles.ts b/apps/edr-freight-web/backoffice/src/components/bookings/booking-ui.styles.ts index c2330977e..6a955237c 100644 --- a/apps/edr-freight-web/backoffice/src/components/bookings/booking-ui.styles.ts +++ b/apps/edr-freight-web/backoffice/src/components/bookings/booking-ui.styles.ts @@ -1,12 +1,10 @@ /** Shared surfaces for booking list & detail — frosted glass, neutral accents. */ export const bookingGlass = { - card: - "border border-border/50 bg-card/75 shadow-sm backdrop-blur-md supports-[backdrop-filter]:bg-card/60", + card: "border border-border/50 bg-card/75 shadow-sm backdrop-blur-md supports-[backdrop-filter]:bg-card/60", panel: "border border-border/50 bg-card/80 shadow-sm backdrop-blur-md supports-[backdrop-filter]:bg-card/65", - rail: - "border border-border/40 bg-muted/20 backdrop-blur-sm supports-[backdrop-filter]:bg-muted/15", + rail: "border border-border/40 bg-muted/20 backdrop-blur-sm supports-[backdrop-filter]:bg-muted/15", iconWell: "border border-border/50 bg-background/70 text-foreground/75 shadow-sm backdrop-blur-sm supports-[backdrop-filter]:bg-background/50", iconWellHero: @@ -22,9 +20,8 @@ export const bookingGlass = { } as const; export const bookingSurface = { - page: - "min-h-screen bg-gradient-to-b from-muted/30 via-background to-background", - pageInner: "mx-auto max-w-[1600px] space-y-5 p-6 lg:p-8", + page: "min-h-screen bg-background ", + pageInner: "mx-auto max-w-[1600px] space-y-5 ", hero: `relative overflow-hidden rounded-2xl ${bookingGlass.card}`, heroGlow: "pointer-events-none absolute -right-24 -top-24 size-72 rounded-full bg-muted/40 blur-3xl", diff --git a/apps/edr-freight-web/backoffice/src/components/layout/FreightDashboardHeader.tsx b/apps/edr-freight-web/backoffice/src/components/layout/FreightDashboardHeader.tsx index 48f13f4ff..64be337b1 100644 --- a/apps/edr-freight-web/backoffice/src/components/layout/FreightDashboardHeader.tsx +++ b/apps/edr-freight-web/backoffice/src/components/layout/FreightDashboardHeader.tsx @@ -56,7 +56,10 @@ const FreightDashboardHeader = ({ if (!isUserMenuOpen) return; const handlePointerDown = (event: MouseEvent) => { - if (userMenuRef.current && !userMenuRef.current.contains(event.target as Node)) { + if ( + userMenuRef.current && + !userMenuRef.current.contains(event.target as Node) + ) { setIsUserMenuOpen(false); } }; @@ -74,10 +77,14 @@ const FreightDashboardHeader = ({ }, [isUserMenuOpen]); return ( -
+
-

{pageMeta.title}

-

{pageMeta.subtitle}

+

+ {pageMeta.title} +

+

+ {pageMeta.subtitle} +

@@ -85,14 +92,24 @@ const FreightDashboardHeader = ({ ) : null} - @@ -101,7 +118,11 @@ const FreightDashboardHeader = ({ - @@ -136,8 +157,12 @@ const FreightDashboardHeader = ({ className="absolute right-0 top-full z-50 mt-2 w-52 overflow-hidden rounded-xl border border-gray-200 bg-white py-1 shadow-lg" >
-

{userName}

- {userEmail ?

{userEmail}

: null} +

+ {userName} +

+ {userEmail ? ( +

{userEmail}

+ ) : null}
setTheme((current) => (current === "dark" ? "light" : "dark")); + const toggleTheme = () => + setTheme((current) => (current === "dark" ? "light" : "dark")); return ( <> @@ -71,17 +74,17 @@ const FreightDashboardLayout = ({ />
-
+
-
+
items.flatMap((item) => { const hrefs: string[] = []; if (item.href) hrefs.push(item.href.toLowerCase()); - if (item.children?.length) hrefs.push(...collectSidebarHrefs(item.children)); + if (item.children?.length) + hrefs.push(...collectSidebarHrefs(item.children)); return hrefs; }); const flattenSectionItems = (sections: SidebarSection[]) => sections.flatMap((section) => section.items); -const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProps) => { +const FreightSidebar = ({ + sections, + activeHref, + onNavigate, +}: FreightSidebarProps) => { const items = useMemo(() => flattenSectionItems(sections), [sections]); const activePath = activeHref?.toLowerCase() ?? ""; const isHrefActive = useCallback( (href: string) => { const normalized = href.toLowerCase(); - return activePath === normalized || activePath.startsWith(`${normalized}/`); + return ( + activePath === normalized || activePath.startsWith(`${normalized}/`) + ); }, [activePath], ); @@ -72,7 +85,8 @@ const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProp return acc; }, [activePath, branchContainsActive, isHrefActive, items]); - const [expanded, setExpanded] = useState>(defaultExpanded); + const [expanded, setExpanded] = + useState>(defaultExpanded); useEffect(() => { setExpanded((current) => ({ ...defaultExpanded, ...current })); @@ -108,7 +122,11 @@ const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProp : "text-gray-900", ); - const renderNavBranch = (children: SidebarItem[], depth: number, parentKey: string) => + const renderNavBranch = ( + children: SidebarItem[], + depth: number, + parentKey: string, + ) => children.map((child) => { const key = sidebarItemKey(child, parentKey); const isGroup = Boolean(child.children?.length) && !child.href; @@ -181,7 +199,9 @@ const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProp const hasChildren = Boolean(item.children?.length); const itemHref = item.href.toLowerCase(); - const childActive = hasChildren ? branchContainsActive(item.children!) : false; + const childActive = hasChildren + ? branchContainsActive(item.children!) + : false; const isCurrentItem = hasChildren ? activePath === itemHref : isHrefActive(itemHref); @@ -206,10 +226,12 @@ const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProp href={item.href} onClick={(event) => navigateTo(event, item.href!)} aria-current={isCurrentItem ? "page" : undefined} - className="flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-base font-medium leading-snug" + className="flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-sm leading-snug" > {item.icon ? ( - {item.icon} + + {item.icon} + ) : null} {item.label} @@ -257,10 +279,12 @@ const FreightSidebar = ({ sections, activeHref, onNavigate }: FreightSidebarProp }; return ( -