import React, { useState } from 'react'; import { motion } from 'framer-motion'; import { LearningSummary, Polyline, Resource } from '../types'; import { X, BookOpen, Activity, Map, PlayCircle, HelpCircle, Sparkles, CheckCircle, TrendingUp, Search, Award, Bookmark } from 'lucide-react'; interface ControlPanelProps { onSummarizeLearning: (title: string, summary: string) => void; onShowPolyline: (polylineId: string) => void; onToggleSimulation: () => void; onPlayPath: () => void; learningData: LearningSummary; polylines: Polyline[]; isSimulationRunning: boolean; isLoading: boolean; learningPath: string[]; bookmarks: string[]; toggleBookmark: (id: string) => void; resources: Resource[]; onResourceClick: (resource: Resource) => void; onStartTutorial: () => void; agent: any; } export const ControlPanel: React.FC = ({ onSummarizeLearning, onShowPolyline, onToggleSimulation, onPlayPath, learningData, polylines, isSimulationRunning, isLoading, learningPath, bookmarks, toggleBookmark, resources, onResourceClick, onStartTutorial, agent }) => { const [showSummaryModal, setShowSummaryModal] = useState(false); const [showPolylineModal, setShowPolylineModal] = useState(false); const [showPolylineListModal, setShowPolylineListModal] = useState(false); const [title, setTitle] = useState(''); const [summary, setSummary] = useState(''); const [selectedPolyline, setSelectedPolyline] = useState(null); const handleSummarySubmit = () => { if (title.trim() && summary.trim()) { onSummarizeLearning(title, summary); setTitle(''); setSummary(''); setShowSummaryModal(false); } }; const handleShowPolyline = () => { const activePolyline = polylines.find(p => p.isActive); if (activePolyline) { setSelectedPolyline(activePolyline); setShowPolylineModal(true); } }; // Generate chart data for polyline visualization const generateChartData = (polyline: Polyline) => { if (polyline.module_scores && polyline.module_scores.length > 0) { return polyline.module_scores.map((score, index) => ({ x: index + 1, y: score })); } const data = []; for (let i = 1; i <= 18; i++) { data.push({ x: i, y: 0.5 + (Math.random() - 0.5) * 0.1 + Math.sin(i * 0.5) * 0.05 }); } return data; }; const topicLegendItems = [ "Pre training objectives", "Pre trained models", "Tutorial: Introduction to huggingface", "Fine tuning LLM", "Instruction tuning", "Prompt based learning", "Parameter efficient fine tuning", "Incontext Learning", "Prompting methods", "Retrieval Methods", "Retrieval Augmented Generation", "Quantization", "Mixture of Experts Model", "Agentic AI", "Multimodal LLMs", "Vision Language Models", "Policy learning using DQN", "RLHF" ]; const activePolyline = polylines.find(p => p.isActive); const generateHighLineData = () => { return topicLegendItems.map((topic, i) => { const res = resources.find(r => r.module === topic); return { x: i + 1, y: res?.high_line || 0.8 }; }); }; const highLineChartData = generateHighLineData(); return (
{/* Header */}

Control Center

Manage your neural sync and analysis

{/* Profile Section */}
Agent Avatar

STUDENT

LVL {agent.level}
{agent.totalReward} pts {(learningData.xp_earned ?? 0) > 0 && ( +{learningData.xp_earned} )}
STUDY POINTS
{/* Scrollable Content Area */}
{/* Control Actions */}
{/* Learning Stats / Insights */} {(learningData.strengths.length > 0 || learningData.recommendations.length > 0 || learningData.ai_analysis) && (

Insights

{learningData.ai_analysis && (
AI feedback

"{learningData.ai_analysis}"

)}
{learningData.strengths.length > 0 && (
Strengths
{learningData.strengths.slice(0, 2).map((strength, i) => ( {strength} ))}
)}
)} {/* Bookmarks Section */}

Bookmarks

{bookmarks.length}
{bookmarks.length > 0 ? ( bookmarks.map(id => { const resource = resources.find(r => r.id === id); if (!resource) return null; return (
onResourceClick(resource)} >

{resource.title}

{resource.module || 'Resource'}

); }) ) : (

No bookmarks saved yet.

)}
{/* Learning Timeline */}

Activity Log

{learningPath.length} items
{learningData.activityLog && learningData.activityLog.length > 0 ? ( learningData.activityLog.slice(0, 15).map((log) => (
{log.type === 'visit' && } {log.type === 'summary' && } {log.type === 'optimal' && } {log.type === 'search' && } {log.type === 'start' && }
{log.timestamp} {log.type === 'optimal' && AI Optimized}
{log.title}
)) ) : (
Environment Ready Initialized learning grid
)}
{/* Summary Modal */} {showSummaryModal && (

Summarize Learning

setTitle(e.target.value)} placeholder="e.g., Introduction to Transformers" className="w-full px-4 py-2.5 bg-gray-50 border border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 outline-none transition-all placeholder:text-gray-400" />