"use client"; import { useState } from "react"; import { useMissionControl } from "@/lib/mission-control/store"; import { TaskStatus } from "@/lib/mission-control/types"; import VoiceChat from "./VoiceChat"; import AIManagement from "@/components/ai-management/AIManagement"; interface SidebarItem { id: string; name: string; icon: string; color?: string; category: string; } interface SidebarCategory { id: string; name: string; icon: string; items: SidebarItem[]; } const sidebarCategories: SidebarCategory[] = [ { id: "projects", name: "Projects", icon: "🎯", items: [ { id: "sitemente", name: "SiteMente", icon: "🌐", color: "#ff7bc0", category: "projects" }, { id: "holacompi", name: "HolaCompi", icon: "🤝", color: "#6366f1", category: "projects" }, ], }, { id: "tasks", name: "Tasks", icon: "✓", items: [ { id: "all", name: "All Tasks", icon: "📋", category: "tasks" }, ], }, { id: "chat", name: "Chat", icon: "💬", items: [ { id: "voice", name: "Voice Chat", icon: "🎤", category: "chat" }, ], }, { id: "council", name: "Council", icon: "🏛️", items: [ { id: "ai-settings", name: "AI Settings", icon: "🤖", category: "council" }, ], }, { id: "calendar", name: "Calendar", icon: "📅", items: [ { id: "brief", name: "Morning Brief", icon: "☀️", category: "calendar" }, ], }, { id: "memory", name: "Memory", icon: "🧠", items: [ { id: "logs", name: "Session Logs", icon: "📝", category: "memory" }, ], }, ]; const statusConfig: Record = { todo: { label: "To Do", color: "text-white/70" }, in_progress: { label: "In Progress", color: "text-yellow-400" }, done: { label: "Done", color: "text-green-400" }, blocked: { label: "Blocked", color: "text-red-400" }, paused: { label: "Paused", color: "text-gray-400" }, }; export default function MissionControlDashboard() { const { tasks, toggleTask, updateTaskStatus, getProjectProgress, getTasksByProject } = useMissionControl(); const [selectedItem, setSelectedItem] = useState("sitemente"); const [filter, setFilter] = useState("all"); const [expandedCategories, setExpandedCategories] = useState(["projects"]); // Find selected item let selectedCategory = sidebarCategories.find(c => c.items.some(i => i.id === selectedItem)); let currentItem = selectedCategory?.items.find(i => i.id === selectedItem); const projectTasks = currentItem?.category === "projects" ? getTasksByProject(selectedItem as any) : tasks; const filteredTasks = filter === "all" ? projectTasks : projectTasks.filter((t) => t.status === filter); const progress = currentItem?.category === "projects" ? getProjectProgress(selectedItem as any) : 0; const toggleCategory = (catId: string) => { setExpandedCategories(prev => prev.includes(catId) ? prev.filter(id => id !== catId) : [...prev, catId] ); }; // Render content based on selection const renderContent = () => { const category = currentItem?.category; if (category === "chat") { return (
); } if (category === "council") { return (
); } if (category === "calendar") { return (

📅 Morning Brief

Daily intelligence at 6am CET

☀️ Open Calendar
); } if (category === "memory") { return (

🧠 Memory & Logs

Session history and daily logs

Memory is stored in:

  • • localStorage (browser)
  • • GitHub repo (daily commits)
  • • MEMORY.md (curated)
); } // Default: Tasks view return renderTasksView(); }; const renderTasksView = () => ( <> {/* Stats Row */}
{(["todo", "in_progress", "done", "blocked"] as TaskStatus[]).map((status) => { const count = projectTasks.filter((t) => t.status === status).length; const config = statusConfig[status]; return ( ); })}
{/* Task List */}

{currentItem?.name || "Tasks"}

{filteredTasks.filter((t) => t.status === "done").length} / {filteredTasks.length} done

{filteredTasks.map((task) => { const config = statusConfig[task.status]; return (

{task.title}

{task.priority === "critical" && ( CRITICAL )}
); })}
{filteredTasks.length === 0 && (
No tasks match the current filter.
)}
); return (
{/* Left Sidebar */} {/* Main Content */}
{/* Header */}

{currentItem?.icon} {currentItem?.name}

{currentItem?.category === "projects" ? `${progress}% complete` : `${tasks.length} total tasks`}

{currentItem?.category === "projects" && (
)}
{/* Content */} {renderContent()}
); }