From 93f87413a03c516c59ca55aec99898a651db97d4 Mon Sep 17 00:00:00 2001
From: njrini99-code
Date: Wed, 1 Jul 2026 12:53:49 -0400
Subject: [PATCH] fix(baseball): render CoachHelm insight body on player
profile (#474)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The CoachHelm engine persists insight detail copy in the `body` column
(engine-run.ts `buildInsightRow` sets `body: c.body`), but the player
profile and command-center peek UIs read only `insight.description`,
which is never populated on engine-generated rows. Titles rendered while
detail/recommended-action copy was blank, making insights look broken.
- Add optional `body?: string | null` to `BaseballCoachInsight` so the UI
can read the engine-persisted column (page selects `*` → body present).
- PlayerInsightsPanel: read `insight.body ?? insight.description` for both
the collapsed preview and the expanded detail paragraph.
- TeamPlayerPeekPanel: read `insight.body ?? insight.description`, matching
the daily brief (`item.body`).
Co-Authored-By: Claude Opus 4.8 (1M context)
Claude-Session: https://claude.ai/code/session_017VUauUXsm9aXegShmpJi5n
---
.../baseball/command-center/TeamPlayerPeekPanel.tsx | 2 +-
.../baseball/player-profile/PlayerInsightsPanel.tsx | 10 ++++++----
src/lib/types/index.ts | 1 +
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/components/baseball/command-center/TeamPlayerPeekPanel.tsx b/src/components/baseball/command-center/TeamPlayerPeekPanel.tsx
index 1f0672920..2337f420d 100644
--- a/src/components/baseball/command-center/TeamPlayerPeekPanel.tsx
+++ b/src/components/baseball/command-center/TeamPlayerPeekPanel.tsx
@@ -260,7 +260,7 @@ export function TeamPlayerPeekPanel({ player, onClose }: TeamPlayerPeekPanelProp
{insight.title}
- {insight.description}
+ {insight.body ?? insight.description}
))}
diff --git a/src/components/baseball/player-profile/PlayerInsightsPanel.tsx b/src/components/baseball/player-profile/PlayerInsightsPanel.tsx
index c90c7cf5a..e806318b0 100644
--- a/src/components/baseball/player-profile/PlayerInsightsPanel.tsx
+++ b/src/components/baseball/player-profile/PlayerInsightsPanel.tsx
@@ -97,6 +97,8 @@ export function PlayerInsightsPanel({ insights, expanded = false }: PlayerInsigh
const colors = priorityColors[insight.priority] || priorityColors.low;
const isExpanded = expandedInsights.has(insight.id) || expanded;
const panelId = `insight-panel-${insight.id}`;
+ // Engine rows persist detail copy in `body`; legacy/manual rows use `description`.
+ const detail = insight.body ?? insight.description;
return (
{insight.title}
- {!isExpanded && insight.description && (
+ {!isExpanded && detail && (
- {insight.description}
+ {detail}
)}
@@ -143,9 +145,9 @@ export function PlayerInsightsPanel({ insights, expanded = false }: PlayerInsigh
className="overflow-hidden"
>
- {insight.description && (
+ {detail && (
- {insight.description}
+ {detail}
)}
diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts
index 2836a8140..bd94f04ab 100644
--- a/src/lib/types/index.ts
+++ b/src/lib/types/index.ts
@@ -263,6 +263,7 @@ export interface BaseballCoachInsight {
title: string;
description: string;
+ body?: string | null; // Engine-persisted insight text (baseball_coach_insights.body); UI reads body ?? description
recommendation?: string;
recommended_action?: string; // Alias for recommendation