import { Antenna, X } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useI18n } from '@/lib/i18n'; export type AGAntenna = { index: number; name: string }; export type AGStatus = { connected: boolean; host?: string; last_error?: string; port_a: number; port_b: number; tx_a?: boolean; tx_b?: boolean; antennas: AGAntenna[]; }; // Format an antenna name: first letter uppercase, the rest lowercase // (e.g. "DX COMMANDER" → "Dx commander"). function pretty(name: string): string { const t = name.trim(); if (!t) return t; return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase(); } // AntGeniusPanel — antenna-switch widget for a 4O3A Antenna Genius, styled to // match the app's light theme with soft gradients + glows. Each antenna row has // a port-A button (left) and port-B button (right). Colours: green = selected on // port A, blue = selected on port B, red (pulsing) = that port is transmitting. // Clicking an already-selected port deselects it (port → None). export function AntGeniusPanel({ status, onActivate, onClose }: { status: AGStatus; onActivate: (port: number, antenna: number) => void; // antenna 0 = deselect onClose: () => void; }) { const { t } = useI18n(); const list = status.antennas ?? []; const PortBtn = ({ port, index, active, tx }: { port: 1 | 2; index: number; active: boolean; tx: boolean }) => { const letter = port === 1 ? 'A' : 'B'; const cls = tx ? 'bg-gradient-to-b from-red-500 to-rose-600 text-white border-red-400/50 shadow-[0_0_10px_rgba(244,63,94,0.5)] animate-pulse' : active ? (port === 1 ? 'bg-gradient-to-b from-emerald-400 to-emerald-600 text-white border-emerald-300/60 shadow-[0_0_9px_rgba(16,185,129,0.45)]' : 'bg-gradient-to-b from-sky-400 to-sky-600 text-white border-sky-300/60 shadow-[0_0_9px_rgba(14,165,233,0.45)]') : 'bg-card text-muted-foreground border-border hover:bg-muted hover:text-foreground'; return ( ); }; return (