From 92545d5734dc5544e4e3632144508439954b267c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 8 Jul 2026 18:06:36 +0000 Subject: [PATCH] Fix differential badge design for mobile search results - Redesign StatusBadge as pill with fixed height, leading-tight, and solid emergent fill to prevent text clipping on small screens - Replace cramped filter tab grid with scrollable flex row using split label/count pills and dynamic All/Presentations/Diagnoses counts - Add narrow-viewport Playwright coverage for single-line tabs and badge Co-authored-by: BigSimmo --- .../clinical-dashboard/differentials-home.tsx | 106 ++++++++++++------ tests/ui-tools.spec.ts | 96 ++++++++++++++++ 2 files changed, 168 insertions(+), 34 deletions(-) diff --git a/src/components/clinical-dashboard/differentials-home.tsx b/src/components/clinical-dashboard/differentials-home.tsx index e6fffb028..7b4aed967 100644 --- a/src/components/clinical-dashboard/differentials-home.tsx +++ b/src/components/clinical-dashboard/differentials-home.tsx @@ -160,14 +160,21 @@ function statusLabel(status: DifferentialRecord["status"]) { } function statusTone(status: DifferentialRecord["status"]) { - if (status === "emergent") - return "border-[color:var(--danger-border)] bg-[color:var(--danger-soft)] text-[color:var(--danger)]"; + if (status === "emergent") return "border-transparent bg-[color:var(--danger)] text-white"; if (status === "urgent") { return "border-[color:var(--warning-border)] bg-[color:var(--warning-soft)] text-[color:var(--warning)]"; } return "border-[color:var(--info-border)] bg-[color:var(--info-soft)] text-[color:var(--info)]"; } +function resultTypeTabCounts(results: DifferentialResult[]) { + return { + all: results.length, + presentations: results.filter((result) => result.href.includes("/presentations")).length, + diagnoses: results.filter((result) => result.href.includes("/diagnoses")).length, + }; +} + function recordIcon(record: DifferentialRecord) { return candidateIconBySlug.find(([fragment]) => record.slug.includes(fragment))?.[1] ?? BrainCircuit; } @@ -230,17 +237,75 @@ function buildDifferentialResults(): DifferentialResult[] { function StatusBadge({ status, className }: { status: DifferentialRecord["status"]; className?: string }) { return ( + {status === "emergent" ? ( + + ) : null} {statusLabel(status)} ); } +function ResultTypeTabs({ results }: { results: DifferentialResult[] }) { + const counts = resultTypeTabCounts(results); + const tabs = [ + { key: "all", label: "All", count: counts.all }, + { key: "presentations", label: "Presentations", count: counts.presentations }, + { key: "diagnoses", label: "Diagnoses", count: counts.diagnoses }, + ] as const; + + return ( +
+ {tabs.map((tab, index) => { + const active = index === 0; + return ( + + ); + })} + +
+ ); +} + function MatchBadge({ label }: { label: string }) { const tone = label === "Best match" @@ -755,39 +820,12 @@ function SearchResultsView({
toggleSelected(best.id)} /> -
- {[ - { label: "All (8)", compact: "All" }, - { label: "Diagnosis (6)", compact: "Dx (6)" }, - { label: "Mimics (2)", compact: "Mimics" }, - ].map((item, index) => ( - - ))} - -
+
- 8 results ·{" "} + + {results.length} result{results.length === 1 ? "" : "s"} + ·{" "} {hasSourceEvidence ? "Ranked by relevance" : "Guided differential view"}