feat: clicking the status-bar amplifier chip toggles OPERATE <-> STANDBY (SPE/ACOM, optimistic flip reconciled by the poll; disabled offline) — PGXL still opens Settings, it has no standby command

This commit is contained in:
2026-07-21 18:54:48 +02:00
parent 0385aed760
commit 1b5b0c2e90
+15 -5
View File
@@ -43,7 +43,7 @@ import {
GetAwardDefs, GetAwardDefs,
GetUIPref, GetActiveProfile, QuitApp, GetUIPref, GetActiveProfile, QuitApp,
ReportLiveActivity, LiveLastQSOAgeSec, ReportLiveActivity, LiveLastQSOAgeSec,
GetPGXLSettings, GetPGXLStatus, GetSPEStatus, GetACOMStatus, GetPGXLSettings, GetPGXLStatus, GetSPEStatus, GetACOMStatus, SPESetOperate, ACOMSetOperate,
} from '../wailsjs/go/main/App'; } from '../wailsjs/go/main/App';
import { Combobox } from '@/components/ui/combobox'; import { Combobox } from '@/components/ui/combobox';
import { applyAwardRefs } from '@/lib/awardRefs'; import { applyAwardRefs } from '@/lib/awardRefs';
@@ -5145,7 +5145,9 @@ export default function App() {
onClick={() => { setSettingsSection('rotator'); setShowSettings(true); }} onClick={() => { setSettingsSection('rotator'); setShowSettings(true); }}
/> />
{/* Amplifier chip: green = OPERATE, orange = STANDBY, red = offline. {/* Amplifier chip: green = OPERATE, orange = STANDBY, red = offline.
(PGXL has no standby notion here green when connected.) */} CLICK toggles OPERATE STANDBY (SPE/ACOM; optimistic flip, the 2s
poll reconciles). The PGXL has no standby command here its chip
opens Settings instead, and shows green when connected. */}
{ampCfg.enabled && (() => { {ampCfg.enabled && (() => {
const isPGXL = ampCfg.type === 'pgxl'; const isPGXL = ampCfg.type === 'pgxl';
const name = isPGXL ? 'PGXL' const name = isPGXL ? 'PGXL'
@@ -5153,12 +5155,20 @@ export default function App() {
: `SPE ${ampSt.model || ''}`.trim(); : `SPE ${ampSt.model || ''}`.trim();
const dot = !ampSt.connected ? 'bg-danger' : (isPGXL || ampSt.operate) ? 'bg-success' : 'bg-warning'; const dot = !ampSt.connected ? 'bg-danger' : (isPGXL || ampSt.operate) ? 'bg-success' : 'bg-warning';
const state = !ampSt.connected ? (ampSt.last_error || 'offline') : (isPGXL ? (ampSt.state || 'connected') : ampSt.operate ? 'OPERATE' : 'STANDBY'); const state = !ampSt.connected ? (ampSt.last_error || 'offline') : (isPGXL ? (ampSt.state || 'connected') : ampSt.operate ? 'OPERATE' : 'STANDBY');
const toggle = () => {
if (isPGXL) { setSettingsSection('pgxl'); setShowSettings(true); return; }
const want = !ampSt.operate;
setAmpSt((s: any) => ({ ...s, operate: want }));
(ampCfg.type.startsWith('acom') ? ACOMSetOperate(want) : SPESetOperate(want)).catch(() => {});
};
return ( return (
<button <button
type="button" type="button"
title={`${name}: ${state}`} disabled={!isPGXL && !ampSt.connected}
onClick={() => { setSettingsSection('pgxl'); setShowSettings(true); }} title={`${name}: ${state}${!isPGXL && ampSt.connected ? (ampSt.operate ? ' — click for STANDBY' : ' — click for OPERATE') : ''}`}
className="inline-flex items-center gap-1.5 px-2 h-5 rounded border text-[11px] transition-colors border-border hover:bg-muted cursor-pointer" onClick={toggle}
className={cn('inline-flex items-center gap-1.5 px-2 h-5 rounded border text-[11px] transition-colors',
(!isPGXL && !ampSt.connected) ? 'opacity-60 cursor-default border-border' : 'border-border hover:bg-muted cursor-pointer')}
> >
<span className={cn('size-2 rounded-full', dot)} /> <span className={cn('size-2 rounded-full', dot)} />
{name} {name}