From f4bc55cd412ecbe3c7cca90176c308873357332f Mon Sep 17 00:00:00 2001 From: rouggy Date: Sat, 25 Jul 2026 11:31:26 +0200 Subject: [PATCH] fix(flex): link TX/RX collapse, equal-size meters, phone-only MIC/COMP, inline S-meter dBm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FlexRadio panel refinements from feedback: - TRANSMIT and RECEIVE now share one collapse state — folding either folds both (Card gained an optional controlled open/onToggle mode; the parent owns the shared txrx state, persisted). - Meter sizes: the Tuner Genius PWR/SWR meters used a 2-column grid (wider than the Flex/amp meters). Switched to the same grid-cols-2 sm:grid-cols-3 so every meter across the METERS, AMPLIFIER and TUNER cards is the same width. - MIC and COMP meters are hidden outside phone modes (shown for SSB/AM/FM only). - S-meter dBm moved inline next to the S-value (was a second line under the bar), and the redundant dBm line under PWR removed — keeps only the watts. Saves height. --- changelog.json | 4 +-- frontend/src/components/FlexPanel.tsx | 42 ++++++++++++++++++--------- frontend/src/components/TunerCard.tsx | 4 +-- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/changelog.json b/changelog.json index e617b14..7ba8878 100644 --- a/changelog.json +++ b/changelog.json @@ -4,7 +4,7 @@ "date": "2026-07-24", "en": [ "New: 4O3A Tuner Genius XL control. Enable it in Settings → Tuner Genius (IP only; port is fixed at 9010). Live SWR and forward power with Tune, Bypass and Operate/Standby, the two channels A/B (source, frequency and antenna) shown and click-selectable. Available as a docked widget, a card in the FlexRadio panel (like the PowerGenius) and a card in Station Control. Controlled directly over TCP, so it uses just one of the box's connection slots.", - "The FlexRadio, amplifier and tuner cards can now be collapsed with the chevron in their header, and the amplifier meters are the same size as the others for a tidier layout.", + "FlexRadio panel tidy-up: cards collapse from the chevron in their header (Transmit and Receive fold together), all meters are the same size, the MIC and COMP meters only show in phone modes, and the S-meter dBm now sits next to the S-value instead of on a second line.", "Fixed the colour theme sometimes reverting to the default when reopening OpsLog — it's now restored reliably.", "ADIF export field picker: the per-group All / None buttons work again.", "Station Control: cards now pack tightly into balanced columns instead of leaving big gaps under shorter panels — a cleaner, more even dashboard.", @@ -14,7 +14,7 @@ ], "fr": [ "Nouveau : contrôle du 4O3A Tuner Genius XL. Active-le dans Réglages → Tuner Genius (IP seulement ; port fixé à 9010). ROS et puissance directe en direct avec Accord, Bypass et Operate/Standby, et les deux canaux A/B (source, fréquence et antenne) affichés et sélectionnables d'un clic. Disponible en widget ancré, en carte dans le panneau FlexRadio (comme le PowerGenius) et en carte dans Station Control. Piloté directement en TCP, il n'utilise qu'une des connexions de la boîte.", - "Les cartes FlexRadio, amplificateur et tuner peuvent maintenant être repliées via le chevron de leur en-tête, et les meters de l'amplificateur ont la même taille que les autres pour une mise en page plus nette.", + "Nettoyage du panneau FlexRadio : les cartes se replient via le chevron de leur en-tête (Transmit et Receive se replient ensemble), tous les meters ont la même taille, les meters MIC et COMP ne s'affichent qu'en phonie, et le dBm du S-mètre est maintenant à côté de la valeur S plutôt que sur une deuxième ligne.", "Correction du thème qui revenait parfois au défaut à la réouverture d'OpsLog — il est maintenant restauré de façon fiable.", "Sélecteur de champs à l'export ADIF : les boutons Tout / Aucun par groupe refonctionnent.", "Station Control : les cartes se rangent en colonnes équilibrées et se tassent au lieu de laisser de gros trous sous les panneaux plus courts — tableau de bord plus propre et régulier.", diff --git a/frontend/src/components/FlexPanel.tsx b/frontend/src/components/FlexPanel.tsx index 57c5773..2a0b877 100644 --- a/frontend/src/components/FlexPanel.tsx +++ b/frontend/src/components/FlexPanel.tsx @@ -262,12 +262,20 @@ function MeterBar({ label, value, unit, lo, hi, accent = '#16a34a', extra, displ ); } -function Card({ icon: Icon, title, accent, children, ckey }: { icon: any; title: string; accent?: string; children: React.ReactNode; ckey?: string }) { - // Collapsible: a chevron in the header hides the body. State persists per card - // (keyed by ckey, falling back to the title) so a folded card stays folded. +function Card({ icon: Icon, title, accent, children, ckey, open: openProp, onToggle }: { + icon: any; title: string; accent?: string; children: React.ReactNode; ckey?: string; + open?: boolean; onToggle?: () => void; // controlled mode — lets sibling cards share one collapse state +}) { + // Collapsible: a chevron in the header hides the body. Uncontrolled by default, + // persisting per card (keyed by ckey, falling back to the title); when `open`/ + // `onToggle` are supplied the parent owns the state (e.g. linked TX/RX cards). 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; }); + const [openState, setOpenState] = useState(() => localStorage.getItem(storeKey) !== '0'); + const controlled = openProp !== undefined; + const open = controlled ? openProp : openState; + const toggle = controlled + ? (onToggle ?? (() => {})) + : () => setOpenState((o) => { const n = !o; localStorage.setItem(storeKey, n ? '1' : '0'); return n; }); return (