import { useTheme } from '../hooks/useTheme' import { useLocalStorage } from '../hooks/useLocalStorage' import { useSSEContext } from '../contexts/SSEContext' import { Sun, Moon, Monitor, Zap, Radio } from 'lucide-react' const SSE_STATUS_COPY: Record = { connected: { label: 'Connected', description: 'Real-time updates are active. Agent status, tasks, and progress stream live.', color: 'text-green-500', }, connecting: { label: 'Connecting…', description: 'Establishing SSE connection to the backend.', color: 'text-yellow-500', }, reconnecting: { label: 'Reconnecting…', description: 'Connection lost. Retrying with exponential back-off.', color: 'text-yellow-500', }, error: { label: 'Disconnected', description: 'Could not connect to the SSE endpoint. Check that the backend is reachable.', color: 'text-red-500', }, } export default function SettingsPage() { const { isDark, toggleTheme } = useTheme() const [gatewayUrl, setGatewayUrl] = useLocalStorage('cc-gateway-url', '') const { sseStatus } = useSSEContext() const sseInfo = SSE_STATUS_COPY[sseStatus] ?? SSE_STATUS_COPY.error return (

Settings

Application preferences

{/* Appearance */}

Appearance

Dark Mode

Toggle between dark and light themes

{/* Connection */}

Connection

setGatewayUrl(e.target.value)} placeholder="http://localhost:8080" className="w-full px-3 py-2 rounded-lg border border-surface-light bg-surface-darkest text-on-surface placeholder:text-on-surface-muted focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors" />

The backend Gateway address for API requests

{/* Real-time connection status */}

Real-time Updates

SSE Connection

{sseInfo.description}

{sseInfo.label}

Endpoint: /api/events  Â· Events: agent.status, agent.task, agent.progress, fleet.update

Polling is disabled. All status updates are pushed from the server over a persistent SSE connection. The client reconnects automatically with exponential back-off on drop.

) }