import type { ConnectionState } from '../../src/acp/types'; import { cn } from '../../src/lib/utils'; // Shared styles for connection state dots const connectionDotStyles: Record = { disconnected: 'bg-gray-400', connecting: 'bg-yellow-400 animate-pulse', connected: 'bg-green-500 shadow-[0_0_8px_rgba(34,197,94,0.6)]', error: 'bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.6)]', }; // Shared labels for connection states const connectionStateLabels: Record = { disconnected: 'Disconnected', connecting: 'Connecting...', connected: 'Connected', error: 'Error', }; /** * Get the display label for a connection state */ export function getConnectionStateLabel(state: ConnectionState): string { return connectionStateLabels[state]; } /** * A small dot indicator for connection state * Used in status bars and headers */ export function StatusDot({ state, className }: { state: ConnectionState; className?: string }) { return ; } /** * A status indicator with dot and label * Used in cards and detailed views */ export function StatusIndicator({ state, className }: { state: ConnectionState; className?: string }) { return ( {state} ); } /** * A complete status bar section with dot, label, and optional URL */ export function ConnectionStatusBar({ state, displayUrl, className, }: { state: ConnectionState; displayUrl?: string; className?: string; }) { return (
{getConnectionStateLabel(state)} {state === 'connected' && displayUrl && ( {displayUrl} )}
); }