import { useRef, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useSimulationState } from '../../store/simulationStore'; const AGENT_COLORS = { MANAGER: 'text-violet-400', SRE: 'text-sky-400', SRE_AGENT:'text-sky-400', CODER: 'text-amber-400', ENGINEER: 'text-amber-400', DETECTIVE:'text-orange-400', }; function agentColor(agent) { const key = String(agent || '').toUpperCase().split('_')[0]; return AGENT_COLORS[agent?.toUpperCase()] || AGENT_COLORS[key] || 'text-zinc-300'; } export default function RewardMathFeed() { const { rewardFeed, totalReward, scenarioComplete } = useSimulationState(); const scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [rewardFeed]); return (
Real-Time Reward Feed = 0 ? 'text-emerald-400' : 'text-red-400'} px-2 py-0.5 rounded bg-zinc-950 border border-zinc-800`}> Σ {(totalReward >= 0 ? '+' : '') + totalReward.toFixed(2)}
{rewardFeed.length > 0 ? ( {rewardFeed.map((entry) => (
{entry.agent} {entry.target} = 0 ? 'text-emerald-400' : 'text-red-400'}`}> {(entry.value >= 0 ? '+' : '') + entry.value.toFixed(2)}
{entry.timestamp}
))} {scenarioComplete && ( [SUCCESS] Incident Closed. Total Σ {(totalReward >= 0 ? '+' : '') + totalReward.toFixed(2)} )}
) : (
{'>'} Σ +0.00

Awaiting real reward events...

)}
); }