'use client'; import { Activity, Server, FileText, Settings } from 'lucide-react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { SystemStatus } from '@/components/process/SystemStatus'; import { ProcessStateChart } from '@/components/charts/ProcessStateChart'; import { ProcessUptimeChart } from '@/components/charts/ProcessUptimeChart'; import { GroupStatistics } from '@/components/charts/GroupStatistics'; import { useProcesses } from '@/lib/hooks/useSupervisor'; import { ProcessState } from '@/lib/supervisor/types'; export default function HomePage() { const { data: processes, isLoading } = useProcesses(); const stats = { total: processes?.length ?? 0, running: processes?.filter((p) => p.state === ProcessState.RUNNING).length ?? 0, stopped: processes?.filter((p) => p.state === ProcessState.STOPPED || p.state === ProcessState.EXITED).length ?? 0, fatal: processes?.filter((p) => p.state === ProcessState.FATAL).length ?? 0, }; return (
{/* Header */}

Supervisor Dashboard

Monitor and manage your processes in real-time

{/* System Status */} {/* Process Statistics */}
Total Processes
{isLoading ? '...' : stats.total}

All configured processes

Running
{isLoading ? '...' : stats.running}

Active processes

Stopped
{isLoading ? '...' : stats.stopped}

Inactive processes

Fatal
{isLoading ? '...' : stats.fatal}

Failed processes

{/* Charts and Analytics */} {!isLoading && processes && processes.length > 0 && (

Analytics

)} {/* Quick Actions */}
window.location.href = '/processes'}>
Manage Processes Start, stop, and restart
window.location.href = '/logs'}>
View Logs Monitor process output
window.location.href = '/config'}>
Configuration Manage settings
); }