[Arch] Duplicated AddShipmentModal and drifted status-color logic #60

Closed
opened 2026-07-01 07:27:01 +02:00 by bullitt · 1 comment
Owner

Severity: Medium | Category: Frontend

AddShipmentModal is implemented near-verbatim in both Dashboard.tsx:72 and Shipments.tsx:63. Separately, eventDotColor (Dashboard) and stateDotColor (ShipmentDetail) map the same state set to colors but have drifted (different "preparing" handling, different fallback opacity).

Recommendation: Extract AddShipmentModal to frontend/src/components/AddShipmentModal.tsx; move the state-color mapping to lib/utils.ts alongside STATE_LABELS.

Full detail: docs/architecture-review.md § C + § H.4

**Severity:** Medium | **Category:** Frontend `AddShipmentModal` is implemented near-verbatim in both `Dashboard.tsx:72` and `Shipments.tsx:63`. Separately, `eventDotColor` (Dashboard) and `stateDotColor` (ShipmentDetail) map the same state set to colors but have drifted (different "preparing" handling, different fallback opacity). **Recommendation:** Extract `AddShipmentModal` to `frontend/src/components/AddShipmentModal.tsx`; move the state-color mapping to `lib/utils.ts` alongside `STATE_LABELS`. Full detail: `docs/architecture-review.md` § C + § H.4
Author
Owner

Fixed on branch architecture-rework, commit 5402f3e: extracted components/AddShipmentModal.tsx, both Dashboard.tsx and Shipments.tsx now import it. Also consolidated the drifted state-color mapping into a single stateDotColor in lib/utils.ts. Verified: tsc --noEmit, eslint, vite build all pass.

Fixed on branch `architecture-rework`, commit 5402f3e: extracted `components/AddShipmentModal.tsx`, both `Dashboard.tsx` and `Shipments.tsx` now import it. Also consolidated the drifted state-color mapping into a single `stateDotColor` in `lib/utils.ts`. Verified: `tsc --noEmit`, `eslint`, `vite build` all pass.
Sign in to join this conversation.
No labels
arch
harness
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bullitt/trackbox#60
No description provided.