import type React from 'react'; import { MessageSquare, Code, FileText, ShieldAlert, List, RefreshCw, Cpu, HardDrive, Database } from 'lucide-react'; import type { ModelInfo } from '../types'; interface DashboardProps { modelInfo: ModelInfo | null; setActiveTab: (tab: string) => void; createNewConversation: (title?: string) => void; sendMessage: (msg: string) => void; } export const Dashboard: React.FC = ({ modelInfo, setActiveTab, createNewConversation, sendMessage, }) => { const quickActions = [ { id: 'chat', title: 'AI Chat', desc: 'Chat with your AI assistant', icon: MessageSquare }, { id: 'playground', title: 'Playground', desc: 'Run code and experiments', icon: Code }, { id: 'explain', title: 'Explain Code', desc: 'Get detailed explanations', icon: FileText, prompt: 'Explain how this code block functions and list edge cases:\n\n' }, { id: 'debug', title: 'Debug Code', desc: 'Find and fix issues', icon: ShieldAlert, prompt: 'Find bugs and syntax errors in this code block:\n\n' }, { id: 'tests', title: 'Generate Tests', desc: 'Create unit tests', icon: List, prompt: 'Write comprehensive unit tests for this code block:\n\n' }, { id: 'refactor', title: 'Refactor Code', desc: 'Improve code quality', icon: RefreshCw, prompt: 'Refactor this code block to improve readability and complexity:\n\n' }, ]; const recentConversations = [ { title: 'Python async queue implementation', time: '2 mins ago' }, { title: 'React custom hook optimization', time: '28 mins ago' }, { title: 'SQL query performance tuning', time: '1 hour ago' }, { title: 'Debug memory leak in Node.js', time: '3 hours ago' }, { title: 'Implement auth with JWT', time: '5 hours ago' }, ]; const examplePrompts = [ { label: 'Explain this code', prompt: 'Explain the runtime complexity of this function:\n\n', icon: FileText }, { label: 'Write a Python function', prompt: 'Write a Python function to check if a string is a palindrome.', icon: Code }, { label: 'Debug this error', prompt: 'Explain how to fix this TypeError exception:\n\n', icon: ShieldAlert }, { label: 'Optimize this SQL query', prompt: 'Optimize this slow SQL query using proper indexes:\n\n', icon: Database }, { label: 'Generate unit tests', prompt: 'Generate unit tests for a standard user authentication class.', icon: List }, ]; const handleActionClick = (action: typeof quickActions[0]) => { if (action.id === 'chat') { createNewConversation(); setActiveTab('chat'); } else if (action.id === 'playground') { setActiveTab('playground'); } else if (action.prompt) { createNewConversation(action.title); setActiveTab('chat'); setTimeout(() => { sendMessage(action.prompt || ''); }, 100); } }; const handlePromptClick = (label: string, promptText: string) => { createNewConversation(label); setActiveTab('chat'); setTimeout(() => { sendMessage(promptText); }, 100); }; const modelName = modelInfo?.model_name || 'SmolLM2-360M-Instruct-Q4_K_M'; return (
{/* Welcome Row with status badges */}

Welcome back, Developer 👋

Your AI Coding Assistant is ready to help you build, debug and ship faster.

LOCAL MODEL: {modelName}
SYSTEM STATUS: Healthy
{/* Grid: System Status */}
{/* Model Status Card */}
Model

{modelName}

Local Inference

{/* Memory Card */}
Model Size

~500 MB

Q4_K_M quantized

{/* Context Card */}
Context

512

Tokens context window

{/* Main Layout Split */}
{/* Left: Quick Actions Grid */}

Quick Actions

Choose a tool to get started

{quickActions.map((action, idx) => { const Icon = action.icon; return ( ); })}
{/* Right: Recent Conversations */}

Recent Conversations

{recentConversations.map((conv, idx) => (
{ createNewConversation(conv.title); setActiveTab('chat'); }} > {conv.title} {conv.time}
))}
{/* Bottom: Example Prompts */}

Example Prompts

Try these examples to get started

{examplePrompts.map((ep, idx) => { const Icon = ep.icon; return ( ); })}
); };