From 457e652310e2fe841e33fda0fb66c5db89ea8c35 Mon Sep 17 00:00:00 2001 From: Neo Date: Thu, 19 Feb 2026 12:06:20 +0000 Subject: [PATCH] Simple debug view --- app/page.tsx | 243 +++++---------------------------------------------- 1 file changed, 22 insertions(+), 221 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index c31978d..ab9f719 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,238 +2,39 @@ import { useState, useEffect } from 'react'; -type TaskStatus = 'todo' | 'in-progress' | 'done'; -type Task = { id: string; title: string; status: TaskStatus; assignee: string; priority?: string }; +type Task = { id: string; title: string; status: string; assignee: string }; type CronJob = { name: string; enabled: boolean; status: string }; -type Memory = { id: string; title: string; date: string; preview: string }; -type ServerStatus = { cpu: string; ram: string; disk: string; uptime: string; containers: string }; -type Backup = { name: string; status: string; lastRun: string }; -type Agent = { name: string; role: string; status: string }; -type WhatsAppStatus = { status: string; chats: number; lastUpdate: string }; export default function MissionControl() { - const [activeTab, setActiveTab] = useState('tasks'); - const [tasks, setTasks] = useState([]); - const [crons, setCrons] = useState([]); - const [memories, setMemories] = useState([]); - const [server, setServer] = useState(null); - const [backups, setBackups] = useState([]); - const [agents, setAgents] = useState([]); - const [whatsapp, setWhatsapp] = useState(null); + const [tab, setTab] = useState('tasks'); + const [data, setData] = useState(null); const [loading, setLoading] = useState(true); - const [mounted, setMounted] = useState(false); useEffect(() => { - setMounted(true); - async function fetchData() { - try { - const [tasksRes, cronsRes, memoryRes, serverRes, backupsRes, agentsRes, waRes] = await Promise.all([ - fetch('/api/data?type=tasks'), - fetch('/api/data?type=crons'), - fetch('/api/data?type=memory'), - fetch('/api/data?type=server'), - fetch('/api/data?type=backups'), - fetch('/api/data?type=agents'), - fetch('/api/data?type=whatsapp') - ]); - setTasks(await tasksRes.json()); - setCrons(await cronsRes.json()); - setMemories(await memoryRes.json()); - setServer(await serverRes.json()); - setBackups(await backupsRes.json()); - setAgents(await agentsRes.json()); - setWhatsapp(await waRes.json()); - } catch (e) { - console.error(e); - } finally { - setLoading(false); - } - } - fetchData(); - }, []); - - const tabs = ['tasks', 'crons', 'server', 'backups', 'agents', 'whatsapp', 'memory']; + setLoading(true); + fetch('/api/data?type=' + tab) + .then(r => r.json()) + .then(d => { setData(d); setLoading(false); }) + .catch(() => setLoading(false)); + }, [tab]); return ( -
- {/* Background */} -
- - {/* Header */} -
-
-
-
-

MISSION CONTROL

-
- -
-
- - {/* Content */} -
- {!mounted || loading ? ( -
-
- -

INITIALIZING...

-
- ) : ( - <> - {activeTab === 'tasks' && } - {activeTab === 'crons' && } - {activeTab === 'server' && } - {activeTab === 'backups' && } - {activeTab === 'agents' && } - {activeTab === 'whatsapp' && } - {activeTab === 'memory' && } - - )} -
-
- ); -} - -function TasksBoard({ tasks }: { tasks: Task[] }) { - const cols: { status: TaskStatus; label: string; color: string }[] = [ - { status: 'todo', label: 'Queued', color: '#fbbf24' }, - { status: 'in-progress', label: 'Active', color: '#ff0050' }, - { status: 'done', label: 'Complete', color: '#00ff88' }, - ]; - return ( -
- {cols.map(col => ( -
-
-
- {col.label} - {tasks.filter(t => t.status === col.status).length} -
- {tasks.filter(t => t.status === col.status).map(task => ( -
-

{task.title}

- @{task.assignee} -
- ))} -
- ))} -
- ); -} - -function CronMonitor({ crons }: { crons: CronJob[] }) { - return ( -
-

⏱ Cron Jobs ({crons.length})

-
- {crons.map((cron, i) => ( -
- {cron.name} - -
+
+

MISSION CONTROL

+ +
+ {['tasks', 'crons', 'server', 'backups', 'agents', 'whatsapp', 'memory'].map(t => ( + ))}
-
- ); -} -function ServerStatus({ server }: { server: ServerStatus | null }) { - if (!server) return

Loading...

; - return ( -
-

🖥 Server Status

-
- {Object.entries(server).map(([key, value]) => ( -
-

{key}

-

{value}

-
- ))} -
+ {loading ? ( +

Loading...

+ ) : ( +
+          {JSON.stringify(data, null, 2)}
+        
+ )}
); } - -function BackupStatus({ backups }: { backups: Backup[] }) { - return ( -
-

💾 Backup Status

- {backups.map((backup, i) => ( -
-
-

{backup.name}

-

{backup.lastRun}

-
- -
- ))} - {backups.length === 0 &&

No backups found

} -
- ); -} - -function AgentStatus({ agents }: { agents: Agent[] }) { - return ( -
-

🤖 Agents

-
- {agents.map((agent, i) => ( -
-
{agent.name[0]}
-
-

{agent.name}

-

{agent.role}

- ● {agent.status} -
-
- ))} -
-
- ); -} - -function WhatsAppStatus({ whatsapp }: { whatsapp: WhatsAppStatus | null }) { - if (!whatsapp) return

Loading...

; - return ( -
-

💬 WhatsApp Chats

-
-
- Status - {whatsapp.status} -
-
- Chats - {whatsapp.chats} -
-
- Last Update - {whatsapp.lastUpdate} -
-
-
- ); -} - -function MemoryVault({ memories }: { memories: Memory[] }) { - const [search, setSearch] = useState(''); - const filtered = memories.filter(m => m.title.toLowerCase().includes(search.toLowerCase())); - return ( -
- setSearch(e.target.value)} style={{ width: '100%', padding: '10px', borderRadius: '8px', border: '1px solid rgba(255,255,255,0.1)', background: 'rgba(20,20,30,0.6)', color: '#e4e4e7', fontSize: '0.8rem', marginBottom: '15px', outline: 'none' }} /> -
- {filtered.map((mem, i) => ( -
-

{mem.title}

- {mem.date} -
- ))} -
-
- ); -} -// Force rebuild Thu Feb 19 11:59:30 AM UTC 2026