import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, Cell } from 'recharts' import type { SimResult } from '../types' interface Props { result: SimResult currentStepIndex: number } export function ScorePanel({ result, currentStepIndex }: Props) { const progress = result.steps.length > 0 ? (currentStepIndex + 1) / result.steps.length : 1 const cumulativeReward = result.steps .slice(0, currentStepIndex + 1) .reduce((sum, s) => sum + s.reward, 0) const displayScore = result.final_score != null ? (currentStepIndex >= result.steps.length - 1 ? result.final_score : null) : null const scoreColor = displayScore == null ? 'text-zinc-400' : displayScore >= 0.6 ? 'text-green-400' : displayScore >= 0.35 ? 'text-orange-400' : 'text-red-400' const rewardData = result.steps.slice(0, currentStepIndex + 1).map((s) => ({ step: s.step, reward: parseFloat(s.reward.toFixed(3)), })) return (

Score

{displayScore != null ? displayScore.toFixed(4) : '—'}
final score
= 0 ? 'text-green-400' : 'text-red-400'}`}> {cumulativeReward >= 0 ? '+' : ''}{cumulativeReward.toFixed(3)}
cumulative reward
{/* Progress bar */}
Step {currentStepIndex + 1} {result.steps_taken} total
{/* Reward chart */} {rewardData.length > 1 && (
{rewardData.map((d, idx) => ( = 0 ? '#22c55e' : '#ef4444'} /> ))}
)}
) }