From dc89522f6d32f9c143f3a76560e13a9385394679 Mon Sep 17 00:00:00 2001 From: njrini99-code Date: Wed, 1 Jul 2026 12:53:22 -0400 Subject: [PATCH] fix(baseball): distinct effectiveness-review badges; stop flagging stable reviews as regression (#498) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EffectivenessReviewRow treated any non-'improved' direction as a regression, so 'no_change' and null (insufficient sample) rendered as a red "Moved the wrong way" badge — misleading coaches into thinking neutral/inconclusive practice reviews hurt performance. Add an effectivenessPresentation() helper (mirroring verdictPresentation) that maps each direction to distinct copy, tone, and glyph: - improved -> success "Associated improvement" (trending up) - regressed -> danger "Moved the wrong way" (trending down) - no_change -> secondary "Held steady" (minus) - null -> secondary "Not enough data" (help) Only 'regressed' uses danger styling now. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017VUauUXsm9aXegShmpJi5n --- .../StaffDecisionRoomClient.tsx | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/src/components/baseball/staff-decision-room/StaffDecisionRoomClient.tsx b/src/components/baseball/staff-decision-room/StaffDecisionRoomClient.tsx index 465e79482..5ab9c184b 100644 --- a/src/components/baseball/staff-decision-room/StaffDecisionRoomClient.tsx +++ b/src/components/baseball/staff-decision-room/StaffDecisionRoomClient.tsx @@ -53,6 +53,8 @@ import { IconGauge, IconTrendingUp, IconTrendingDown, + IconMinus, + IconHelp, IconTrophy, IconShieldAlert, IconCalendar, @@ -154,6 +156,31 @@ function verdictPresentation( } } +// --- Practice Effectiveness direction presentation -------------------------- +// Honest by construction: only 'regressed' earns danger styling. 'no_change' +// (metric held steady) and null (insufficient sample) read neutral — they were +// previously mislabeled as "Moved the wrong way" in red. (Issue #498) +interface EffectivenessPresentation { + label: string; + tone: 'success' | 'danger' | 'secondary'; + /** Direction glyph for the badge. */ + glyph: 'up' | 'down' | 'flat' | 'unknown'; +} +function effectivenessPresentation( + direction: DecisionRoomEffectivenessReview['direction'], +): EffectivenessPresentation { + switch (direction) { + case 'improved': + return { label: 'Associated improvement', tone: 'success', glyph: 'up' }; + case 'regressed': + return { label: 'Moved the wrong way', tone: 'danger', glyph: 'down' }; + case 'no_change': + return { label: 'Held steady', tone: 'secondary', glyph: 'flat' }; + default: + return { label: 'Not enough data', tone: 'secondary', glyph: 'unknown' }; + } +} + /** Format a metric value honoring its unit (pct → %, else 1-dp number). */ function formatMetricValue(value: number | null, unit: string | null): string { if (value == null) return '—'; @@ -1263,16 +1290,24 @@ function EffectivenessReviewRow({ }: { review: DecisionRoomEffectivenessReview; }) { - const improved = review.direction === 'improved'; + const pres = effectivenessPresentation(review.direction); return (
- + - {improved ? : } + {pres.glyph === 'up' ? ( + + ) : pres.glyph === 'down' ? ( + + ) : pres.glyph === 'flat' ? ( + + ) : ( + + )} - {improved ? 'Associated improvement' : 'Moved the wrong way'} + {pres.label}