feat: my rig and my antenna as dropdowns, and a ceiling on the decodes

The rigs and antennas are already declared once, in Settings ▸ Operating
conditions — a station per rig with its antennas hanging off it — and
then typed again into every contact. That is work, and it is a source of
spellings that do not match: "IC-7610", "IC 7610" and "ic7610" are three
different rigs to an award, to a filter, and to anyone reading the log
later.

Both fields now offer that list, in the entry form and in the QSO editor,
and the antenna field offers the antennas of the rig that was picked
because that is the structure the tree already has. It falls back to all
of them for a rig the tree does not know, so an operator typing a
borrowed rig is still offered their own antennas rather than nothing.
Free text stays allowed throughout — a contact made from somebody else's
station, or imported from another logger, carries a rig that was never in
this tree and must still be loggable. Same rule the satellite-name field
follows.

And the decodes list gains a ceiling of two thousand rows. The rolling
half hour was never a limit on a crowded evening — three decoders put
several thousand rows inside it — and the panel slows down long before
the age cut removes any of them, because each row is a layout, a status
lookup and a distance. Past the ceiling the oldest go: what has already
been scrolled past, rather than the period being read.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
2026-09-08 21:52:38 +02:00
co-authored by Claude Opus 5
parent 6f1c998a26
commit dbeabc1bae
5 changed files with 114 additions and 7 deletions
+12 -1
View File
@@ -2594,6 +2594,15 @@ export default function App() {
// half hour — long enough to hold a whole opening, short enough that a night
// of FT8 on 20 m does not turn the list into something no filter can rescue.
const DECODE_KEEP_MS = 30 * 60 * 1000;
// And a hard ceiling on the count, because the half hour is not one on a
// crowded band.
//
// Three decoders on an open evening put several thousand rows in that window,
// and the panel slows down long before the age limit removes any of them:
// every one is a row to lay out, a status to resolve and a distance to work
// out. Two thousand is more than a screen can hold many times over, and past
// it the oldest go — the newest period is what an operator is reading.
const DECODE_MAX = 2000;
const [decodes, setDecodes] = useState<DecodeRow[]>([]);
const [txMsgs, setTxMsgs] = useState<TxMsgRow[]>([]);
// The LIVE transmit state, replaced on every Status — what is going out now
@@ -3887,7 +3896,9 @@ export default function App() {
return !b2 || (d.band ?? '').toLowerCase() === b2;
});
const next = [...kept, ...fresh].filter((d) => Date.parse(d.at) >= cutoff);
return next;
// Oldest first in this list, so the ceiling is applied from the front:
// what goes is what was already scrolled past.
return next.length > DECODE_MAX ? next.slice(next.length - DECODE_MAX) : next;
});
};
flushDecodesRef.current = () => { void flushDecodes(); };
+14 -2
View File
@@ -9,6 +9,7 @@ import {
import { cn } from '@/lib/utils';
import { useI18n } from '@/lib/i18n';
import { Combobox } from '@/components/ui/combobox';
import { useOperatingLists } from '@/lib/operatingLists';
import { pathBetween, pathBetweenLatLon, gridToLatLon } from '@/lib/maidenhead';
import { BandSlotGrid } from '@/components/BandSlotGrid';
import { AwardRefSelector } from '@/components/AwardRefSelector';
@@ -158,6 +159,7 @@ function Field({ label, span = 1, className, children }: { label: string; span?:
export function DetailsPanel({ callsign, prefix, operatorGrid, remoteGrid, qth, name, country, comment, note, details, onChange, wb, wbBusy, band, mode, bands, modes, satellites = [], slotCall, slotBand, slotMode, slotWb, slotWbBusy, tab, onTab, keyerActive, onEditQso }: Props) {
const { t } = useI18n();
const oper = useOperatingLists(tab);
const [internalOpen, setInternalOpen] = useState<TabName>('stats');
const open = tab ?? internalOpen; // controlled when `tab` is provided
@@ -476,11 +478,21 @@ export function DetailsPanel({ callsign, prefix, operatorGrid, remoteGrid, qth,
</SelectContent>
</Select>
</Field>
{/* The rigs and antennas already declared in Settings ▸ Operating
conditions. Typing them again on every contact is both work and a
source of spellings that do not match — "IC-7610", "IC 7610" and
"ic7610" are three different rigs to an award and to a filter.
Free text stays allowed: a QSO made from somebody else's station
carries a rig that was never in this tree. */}
<Field label={t('detp.rig')} span={3}>
<Input value={details.my_rig} onChange={(e) => onChange({ my_rig: e.target.value })} />
<Combobox value={details.my_rig} options={oper.rigs} showToggle allowFreeText
onChange={(v) => onChange({ my_rig: v })} />
</Field>
<Field label={t('detp.antenna')} span={3}>
<Input value={details.my_antenna} onChange={(e) => onChange({ my_antenna: e.target.value })} />
{/* The antennas of the chosen rig, since that is what they hang off
— and all of them when the rig is one this tree does not know. */}
<Combobox value={details.my_antenna} options={oper.antennasFor(details.my_rig)} showToggle allowFreeText
onChange={(v) => onChange({ my_antenna: v })} />
</Field>
{satelliteMode && (
<>
+16 -2
View File
@@ -19,6 +19,7 @@ import {
} from '@/components/ui/select';
import { Checkbox } from '@/components/ui/checkbox';
import { Combobox } from '@/components/ui/combobox';
import { useOperatingLists } from '@/lib/operatingLists';
import { cn } from '@/lib/utils';
import { flagURL } from '@/lib/flags';
import { useI18n } from '@/lib/i18n';
@@ -288,6 +289,9 @@ function QslViaSelect({ value, onChange }: { value?: string; onChange: (v: strin
export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], bands, modes }: Props) {
const { t } = useI18n();
// Read once per opening of the editor: rigs and antennas do not change while
// a contact is being corrected.
const oper = useOperatingLists();
// Use the operator's configured band/mode lists (incl. custom ones like 13cm);
// fall back to the built-in sets. Always include the QSO's own band/mode so an
// imported/legacy value is never silently dropped from the dropdown.
@@ -982,8 +986,18 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
<F label={t('qedit.street')} span={2}><Input value={draft.my_street ?? ''} onChange={(e) => set('my_street', e.target.value)} /></F>
<F label={t('qedit.city')} span={2}><Input value={draft.my_city ?? ''} onChange={(e) => set('my_city', e.target.value)} /></F>
<F label={t('qedit.postal')} span={2}><Input value={draft.my_postal_code ?? ''} onChange={(e) => set('my_postal_code', e.target.value)} /></F>
<F label={t('qedit.rig')} span={3}><Input value={draft.my_rig ?? ''} onChange={(e) => set('my_rig', e.target.value)} /></F>
<F label={t('qedit.antenna')} span={3}><Input value={draft.my_antenna ?? ''} onChange={(e) => set('my_antenna', e.target.value)} /></F>
{/* The station's own rigs and antennas (Settings ▸ Operating
conditions), so a correction here spells them the same way
the log already does. Free text stays: an imported contact
carries whatever the other logger wrote. */}
<F label={t('qedit.rig')} span={3}>
<Combobox value={draft.my_rig ?? ''} options={oper.rigs} showToggle allowFreeText
onChange={(v) => set('my_rig', v)} />
</F>
<F label={t('qedit.antenna')} span={3}>
<Combobox value={draft.my_antenna ?? ''} options={oper.antennasFor(draft.my_rig ?? '')} showToggle allowFreeText
onChange={(v) => set('my_antenna', v)} />
</F>
</div>
</TabsContent>
+66
View File
@@ -0,0 +1,66 @@
// The station's own rigs and antennas, for the MY_RIG and MY_ANTENNA fields.
//
// They are already defined once, in Settings ▸ Operating conditions — a station
// per rig, with the antennas hanging off it. Typing them again into every
// contact is both work and a source of spellings that do not match: "IC-7610",
// "IC 7610" and "ic7610" are three different rigs to an award, a filter and to
// anyone reading the log later.
//
// So the two fields offer what the operator has already declared. FREE TEXT
// stays allowed: a QSO made from somebody else's station, or imported from
// another logger, carries a rig that was never in this tree and must still be
// loggable — the same rule the satellite-name field follows.
import { useEffect, useState } from 'react';
import { ListOperatingTree } from '../../wailsjs/go/main/App';
export type OperatingLists = {
rigs: string[];
// Every antenna in the profile, whichever rig it belongs to.
antennas: string[];
// The antennas of ONE rig. Falls back to all of them for a rig that is not in
// the tree — an operator typing a borrowed rig's name should still be offered
// their own antennas rather than nothing.
antennasFor: (rig: string) => string[];
};
const EMPTY: OperatingLists = { rigs: [], antennas: [], antennasFor: () => [] };
function build(stations: any[]): OperatingLists {
const rigs: string[] = [];
const byRig = new Map<string, string[]>();
const all = new Set<string>();
for (const st of stations ?? []) {
const name = String(st?.name ?? '').trim();
const ants = ((st?.antennas ?? []) as any[])
.map((a) => String(a?.name ?? '').trim())
.filter(Boolean);
if (name) {
rigs.push(name);
byRig.set(name.toUpperCase(), ants);
}
for (const a of ants) all.add(a);
}
const antennas = [...all];
return {
rigs,
antennas,
antennasFor: (rig: string) => byRig.get(String(rig ?? '').trim().toUpperCase()) ?? antennas,
};
}
// useOperatingLists reads the tree when the component mounts, and again whenever
// `reloadKey` changes — pass something that moves when Preferences close, so a
// rig added there is offered without a restart.
export function useOperatingLists(reloadKey?: unknown): OperatingLists {
const [lists, setLists] = useState<OperatingLists>(EMPTY);
useEffect(() => {
let live = true;
ListOperatingTree()
.then((st: any) => { if (live) setLists(build(st ?? [])); })
// An empty list simply leaves both fields as free text, which is what they
// were before they had a list at all.
.catch(() => {});
return () => { live = false; };
}, [reloadKey]);
return lists;
}