feat: collapsible Flex/amp/tuner cards, matched meter sizes, faster + distinct-icon TGXL
Addresses three points of feedback on the Tuner Genius work: - Meter sizes: the amplifier meters were rendered `compact` (smaller than the FlexRadio meters). Dropped compact so the amp, tuner and Flex meters are all the same size. - Collapsible cards: the FlexRadio panel Card, AmpCard and TunerCard now fold from a chevron in the header, state persisted per card (opslog.cardOpen.*). The amplifier cards share the "amplifier" collapse key across their SPE/ACOM/ PGXL variants so folding sticks regardless of the shown model. - TGXL responsiveness: the tuner's device poll dropped 1500ms→400ms and the three UI pollers 1500ms→500ms, so the SWR/power meters track TX without the 2–3s lag behind the amplifier the user saw. - Icon: the Tuner Genius top-bar toggle used Zap, same as the CW keyer — changed the tuner's icon (top bar + widget + card) to Gauge so the two are distinct.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Zap, Radio } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { Gauge, Radio, ChevronDown } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { TGStatus, TGChannel } from '@/components/TunerGeniusPanel';
|
||||
import { TunerGeniusAutotune, TunerGeniusSetBypass, TunerGeniusSetOperate, TunerGeniusActivate } from '../../wailsjs/go/main/App';
|
||||
@@ -46,14 +47,20 @@ function MeterBar({ label, value, unit, lo, hi, accent = '#16a34a', display, seg
|
||||
);
|
||||
}
|
||||
|
||||
function Card({ icon: Icon, title, accent, children }: { icon: any; title: string; accent?: string; children: React.ReactNode }) {
|
||||
function Card({ icon: Icon, title, accent, children, ckey }: { icon: any; title: string; accent?: string; children: React.ReactNode; ckey?: string }) {
|
||||
// Collapsible with persisted state — same behaviour as the FlexRadio panel's Card.
|
||||
const storeKey = 'opslog.cardOpen.' + (ckey || title);
|
||||
const [open, setOpen] = useState(() => localStorage.getItem(storeKey) !== '0');
|
||||
const toggle = () => setOpen((o) => { const n = !o; localStorage.setItem(storeKey, n ? '1' : '0'); return n; });
|
||||
return (
|
||||
<div className="rounded-xl border border-border bg-card shadow-sm overflow-hidden">
|
||||
<div className="flex items-center gap-2 px-3 py-2 border-b border-border/60 bg-muted/30">
|
||||
<button type="button" onClick={toggle}
|
||||
className={cn('w-full flex items-center gap-2 px-3 py-2 bg-muted/30 hover:bg-muted/50 transition-colors text-left', open && 'border-b border-border/60')}>
|
||||
<Icon className="size-4" style={{ color: accent ?? 'var(--primary)' }} />
|
||||
<span className="text-xs font-bold uppercase tracking-wider text-foreground/80">{title}</span>
|
||||
</div>
|
||||
<div className="p-3 space-y-3">{children}</div>
|
||||
<ChevronDown className={cn('ml-auto size-4 text-muted-foreground transition-transform', !open && '-rotate-90')} />
|
||||
</button>
|
||||
{open && <div className="p-3 space-y-3">{children}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -102,7 +109,7 @@ export function TunerCard({ status, t }: { status: TGStatus; t: (k: string, v?:
|
||||
|
||||
const title = `${t('tgp.title')}${status.host ? ' · ' + status.host : ''}`;
|
||||
return (
|
||||
<Card icon={Zap} title={title} accent="#f59e0b">
|
||||
<Card icon={Gauge} title={title} accent="#f59e0b">
|
||||
<div className="flex items-center gap-3 flex-wrap">
|
||||
<button type="button" disabled={!connected}
|
||||
onClick={() => TunerGeniusSetOperate(!status.operate).catch(() => {})}
|
||||
|
||||
Reference in New Issue
Block a user