From 8e4289b1046ab74a3eae7ad78222142348fe3610 Mon Sep 17 00:00:00 2001 From: SJCoetz Date: Fri, 10 Jul 2026 23:55:23 +0200 Subject: [PATCH] fix(collection-pool): align SupplierGroup with spec (a11y, chevron, assign) --- src/app/(app)/collection-pool/page.tsx | 95 ++++++++++++-------------- 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/src/app/(app)/collection-pool/page.tsx b/src/app/(app)/collection-pool/page.tsx index 5463908..ec990a9 100644 --- a/src/app/(app)/collection-pool/page.tsx +++ b/src/app/(app)/collection-pool/page.tsx @@ -3,6 +3,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { AlertTriangle, + ChevronDown, Loader2, Search, Truck, @@ -23,12 +24,12 @@ import type { OrderItem } from "@/lib/types"; import { cn } from "@/lib/utils"; import { - getAssignmentBadge, buildProximityMarkerMap, + buildSupplierGroups, buildVisibleRows, type CollectionPoolGroup, type CollectionPoolSortMode, - type CollectionPoolViewRow, + getAssignmentBadge, getAssignmentState, getPoolAgeLabel, } from "./view-model"; @@ -734,6 +735,11 @@ function SupplierGroup({ onOpenBulkAssign, onToggleReady, }: { + // `group.rows` is typed as `CollectionPoolViewRow[]` in the helper, but + // `PoolRow` (this page's existing row component) expects the richer + // `CollectionPoolVisibleRow` (which extends `OrderItem`). The widening is + // sound because `buildSupplierGroups` is fed `CollectionPoolVisibleRow[]` + // — see Task 7 wiring. group: Omit & { rows: CollectionPoolVisibleRow[] }; busy: boolean; todayYmd: string; @@ -763,43 +769,39 @@ function SupplierGroup({ })(); const assignLabel = allSelected - ? `Assign all ${rowIds.length} ${rowIds.length === 1 ? "stop" : "stops"}` + ? `Assign ${rowIds.length} stops` : selectedCount > 0 ? `Assign ${selectedCount} selected` - : `Assign all ${rowIds.length} ${rowIds.length === 1 ? "stop" : "stops"}`; + : `Assign all ${rowIds.length}`; + + const onAssignClick = () => { + const ids = allSelected || selectedCount === 0 ? rowIds : rowIds.filter((id) => selectedIds.has(id)); + onOpenBulkAssign(group.supplierId, group.supplierName, ids); + }; return (
-
+
-
-

- {group.supplierName || "Unknown supplier"} -

- · - - {rowIds.length} {rowIds.length === 1 ? "stop" : "stops"} - - {eyebrowText && ( - <> - · - {eyebrowText} - - )} -
-
- {rowIds.length > 0 && ( +

+ {group.supplierName || "Unknown supplier"} +

+ + · {group.rows.length} {group.rows.length === 1 ? "stop" : "stops"} + {eyebrowText ? <> · {eyebrowText} : null} + +
+
-
    +
      {group.rows.map((row) => (