From 3fec07ca4df1175619412f12c6d9c32411553a34 Mon Sep 17 00:00:00 2001 From: Tyler Date: Sat, 20 Jun 2026 11:49:18 -0600 Subject: [PATCH] style(frontend): tidy drawer review nits - RawSegmentsPanel: summary now reads 'Show N raw segments' for non-empty (with singular pluralization). The previous identical ternary branches read as a bug. - PartiesGrid: replace the verbose intersection cast on AddressBlock with a direct ClaimDetailAddress cast (the union's other arm is Record, ruled out by isEmptyAddress above). --- src/components/ClaimDrawer/PartiesGrid.tsx | 14 ++++---------- src/components/ClaimDrawer/RawSegmentsPanel.tsx | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/ClaimDrawer/PartiesGrid.tsx b/src/components/ClaimDrawer/PartiesGrid.tsx index 03d3e0a..9a9de33 100644 --- a/src/components/ClaimDrawer/PartiesGrid.tsx +++ b/src/components/ClaimDrawer/PartiesGrid.tsx @@ -1,4 +1,4 @@ -import type { ClaimDetail } from "@/types"; +import type { ClaimDetail, ClaimDetailAddress } from "@/types"; type PartiesGridProps = { parties: ClaimDetail["parties"]; @@ -20,15 +20,9 @@ function isEmptyAddress(addr: AddressLike | null | undefined): boolean { function AddressBlock({ address }: { address: AddressLike }) { if (isEmptyAddress(address)) return null; - // After the empty check the cast is safe; the alternative `ClaimDetailAddress` - // shape has all the fields we read. - const a = address as ClaimDetail["parties"]["billingProvider"]["address"] & { - line1: string; - line2: string | null; - city: string; - state: string; - zip: string; - }; + // After the empty check the cast is safe — the remaining union arm is + // `ClaimDetailAddress` which has all the fields we read. + const a = address as ClaimDetailAddress; return (
{rawSegments.length === 0 - ? "Show raw segments" - : "Show raw segments"} + ? `Show raw segments` + : `Show ${rawSegments.length} raw segment${rawSegments.length === 1 ? "" : "s"}`} {rawSegments.length === 0 ? (