"use client"; import { useState, useEffect } from "react"; import { useMissionControl } from "@/lib/mission-control/store"; import { TaskStatus } from "@/lib/mission-control/types"; import HorusChat from "./HorusChat"; import MondayBoard from "./MondayBoard"; import { TaskCardsPanel } from "./TaskCardsPanel"; import { TaskHistoryPanel } from "./TaskHistoryPanel"; import { TradingPanel } from "./TradingPanel"; import AIManagement from "@/components/ai-management/AIManagement"; import Council from "@/components/council/Council"; 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: "leads", name: "Leads", icon: "📈", items: [ { id: "leads-crm", name: "CRM", icon: "📊", category: "leads" }, { id: "dashboard", name: "Client Dashboard", icon: "🏢", category: "dashboard" }, ]}, { id: "projects", name: "Projects", icon: "🎯", items: [ { id: "monday", name: "Monday Board", icon: "📊", category: "monday" }, { id: "sitemente", name: "SiteMente", icon: "🌐", color: "#ff7bc0", category: "projects" }, { id: "demos", name: "Demo Pages", icon: "🎨", category: "demos" }, { id: "holacompi", name: "HolaCompi", icon: "🤝", color: "#6366f1", category: "projects" }, { id: "arabredox", name: "Arabredox", icon: "💚", color: "#22c55e", category: "projects" }, { id: "infrastructure", name: "Infra", icon: "⚙️", color: "#10b981", category: "projects" }, ]}, { id: "trading", name: "Trading", icon: "📈", items: [ { id: "trading-research", name: "Deep Research", icon: "🔬", category: "trading" }, { id: "trading-strategies", name: "Strategies", icon: "🎯", category: "trading" }, { id: "trading-execution", name: "Execution", icon: "⚡", category: "trading" }, { id: "trading-journal", name: "Journal", icon: "📔", category: "trading" }, ]}, { id: "tasks", name: "Tasks", icon: "✓", items: [ { id: "task-cards", name: "Task Cards", icon: "☑️", category: "task-cards" }, { id: "task-history", name: "History", icon: "📜", category: "task-history" }, ]}, { id: "chat", name: "Chat", icon: "💬", items: [ { id: "voice", name: "Voice Chat", icon: "🎤", category: "chat" }, { id: "horus-chat", name: "Horus Chat", icon: "👁️", category: "horus-chat" }, ]}, { id: "council", name: "Council", icon: "🏛️", items: [ { id: "teams", name: "Agent Teams", icon: "👥", category: "council" }, { id: "golden-notes", name: "Golden Notes", icon: "🔥", category: "golden-notes" }, { id: "daily-feedback", name: "Daily Feedback", icon: "📝", category: "daily-feedback" }, { id: "ai-settings", name: "AI Settings", icon: "🤖", category: "council-settings" }, ]}, { id: "calendar", name: "Calendar", icon: "📅", items: [ { id: "brief", name: "Morning Brief", icon: "☀️", category: "calendar" }, { id: "briefs", name: "All Briefs", icon: "📋", category: "briefs" }, { id: "transcripts", name: "Transcripts", icon: "🎬", category: "transcripts" }, ]}, { id: "memory", name: "Memory", icon: "🧠", items: [ { id: "logs", name: "Session Logs", icon: "📝", category: "memory" }, { id: "snapshots", name: "Snapshots", icon: "📸", category: "snapshots" }, ]}, { id: "docs", name: "Docs", icon: "📚", items: [ { id: "docs-index", name: "Documentation", icon: "📚", category: "docs" }, ]}, ]; 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" }, }; interface MissionControlDashboardProps { onLogout?: () => void; } export default function MissionControlDashboard({ onLogout }: MissionControlDashboardProps) { const { tasks, toggleTask, updateTaskStatus, addTask, getProjectProgress, getTasksByProject } = useMissionControl(); const [mounted, setMounted] = useState(false); const [selectedItem, setSelectedItem] = useState("sitemente"); const [filter, setFilter] = useState("all"); const [expandedCategories, setExpandedCategories] = useState(["projects"]); const [searchQuery, setSearchQuery] = useState(""); const [showAddTask, setShowAddTask] = useState(false); const [newTaskTitle, setNewTaskTitle] = useState(""); const [newTaskProject, setNewTaskProject] = useState("sitemente"); useEffect(() => { setMounted(true); }, []); useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if (e.key === "/" && !e.ctrlKey && !e.metaKey) { const target = e.target as HTMLElement; if (target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") { e.preventDefault(); document.getElementById("search-input")?.focus(); } } if (e.key === "n" && (e.ctrlKey || e.metaKey)) { e.preventDefault(); setShowAddTask(true); } if (e.key === "Escape") { setShowAddTask(false); setSearchQuery(""); } }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, []); 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 searchedTasks = searchQuery ? filteredTasks.filter(t => t.title.toLowerCase().includes(searchQuery.toLowerCase())) : filteredTasks; 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]); const collapseAll = () => setExpandedCategories([]); const todayTasks = projectTasks.filter(t => t.priority === "critical" || t.status === "in_progress").slice(0, 3); const exportTasks = () => { const data = JSON.stringify(projectTasks, null, 2); const blob = new Blob([data], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = `tasks-${new Date().toISOString().split("T")[0]}.json`; a.click(); }; const handleAddTask = () => { if (!newTaskTitle.trim()) return; addTask({ title: newTaskTitle, description: "", status: "todo", priority: "medium", project: newTaskProject as any }); setShowAddTask(false); setNewTaskTitle(""); }; if (!mounted) { return (
Loading...
); } // Golden Notes - moved to Council tab // Removed from home page per user request return (

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

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

{currentItem?.category === "projects" && (
)}
{currentItem?.category === "chat" &&
} {currentItem?.category === "horus-chat" && (
)} {currentItem?.category === "monday" &&
} {currentItem?.category === "council" && currentItem?.id === "teams" &&
} {currentItem?.category === "council-settings" &&
} {currentItem?.category === "golden-notes" && (
🔥

Golden Notes

Insights and wisdom from the agent council

👁️ HORUS
  • • Your frame: "safe" → should be "leading"
  • • Own the Egyptian-Scandinavian contrast
  • • Fun first, lead often, let go
👁️ THOTH (Strategy)
  • • Stop tracking "case notes" — creates attachment
  • • Signal intent early: comfort → curiosity → desire
🏗️ PTAH (Builder)
  • • You're over-engineering. Strip it down.
  • • Friendzone = too much comfort before desire
📜 SESHAT (Records)
  • • Delete case notes entirely
  • • Write forward, analyze backward less
🐺 ANUBIS (Connector)
  • • Calm + leading = attractive | Calm + passive = friend
  • • Make small demands, create reasons to meet
📈 THOTH TRADING (Observer)
  • • You're in accumulation, need breakout
  • • Introduce escalation every 7-10 messages
⚔️ SEKHMET (Action)
  • • You're too nice in approach
  • • Tease more, challenge more, lead more
)} {currentItem?.category === "daily-feedback" && (
📝

Daily Feedback

{new Date().toLocaleDateString()}

End-of-day insights from all agents. Select notes to promote to Golden.

👁️ HORUS