import { motion } from 'framer-motion'; import { LineChart, Line, XAxis, YAxis, ResponsiveContainer } from 'recharts'; const EmotionTimeline = ({ history }) => { // Prepare data for chart const chartData = history.map((item, index) => ({ time: index, engagement: item.engagement * 100, confidence: item.confidence * 100, emotion: Object.entries(item.emotion.predictions).reduce((a, b) => a[1] > b[1] ? a : b)[1] * 100 })); const emotionColors = { happy: '#10B981', sad: '#3B82F6', angry: '#EF4444', fear: '#8B5CF6', surprise: '#F59E0B', disgust: '#6B7280', neutral: '#9CA3AF' }; return (
{/* Current Emotion Display */} {history.length > 0 && (
{history[history.length - 1].emotion.dominant === 'happy' && '😊'} {history[history.length - 1].emotion.dominant === 'sad' && '😢'} {history[history.length - 1].emotion.dominant === 'angry' && '😠'} {history[history.length - 1].emotion.dominant === 'fear' && '😨'} {history[history.length - 1].emotion.dominant === 'surprise' && '😲'} {history[history.length - 1].emotion.dominant === 'disgust' && '🤢'} {history[history.length - 1].emotion.dominant === 'neutral' && '😐'}

{history[history.length - 1].emotion.dominant}

)} {/* Timeline Chart */}
{/* Legend */}
Engagement
Confidence
Emotion Strength
); }; export default EmotionTimeline;