feat(decodes): answer a station on click, DT and Freq, badge filters
Clicking a decode now ANSWERS it. It sends WSJT-X/MSHV a Reply message (type 4), which is the same thing as double-clicking the line in their own Band Activity window: the application looks the decode up, sets its transmit frequency to the caller's and starts the exchange. It deliberately does not tune the radio, which is what it did before and why nothing happened. On FT8 the whole band sits inside one passband, so moving the dial changes nothing about who gets answered - the decision belongs to the decoding application, and the Reply is the only way to hand it over. Tuning would also just fight it for the VFO. The entry is still filled so the QSO can be logged here. The reply is routed by PROGRAM ID, not by listener: two receivers can share one multicast group, and answering a station heard on the 6 m instance by talking to the 20 m one would start a call on the wrong band. It goes to the address that instance's packets actually arrive from - a multicast listener must answer the sender, never the group. WSJT-X matches the reply against its own decode list, so the payload replays the decode field for field: time, snr, delta time, audio offset, mode and message text. Two columns added, DT and Freq - the audio offset inside the passband, not the RF frequency, which is the same for every station in the list and says nothing. Past about two seconds DT takes a warning tint: that station is drifting out of the window. The transmit strip. "You cannot see what you are sending, or who you are calling" - two separate faults. The message was only ever threaded into its period, and in FT8 you transmit in the slots you are NOT receiving in, so its period had no decodes and the whole line was dropped; a transmit slot now creates its period. And the state is a strip of its own at the top, because it is the one thing on the screen that is about the operator rather than the band. It is fed by every Status rather than only by one carrying transmit text, so it can still name the station being called on MSHV and older JTDX builds, which stop before tx_message in the Status payload. "New only" became per-category badges, in the colours and the vocabulary of the Chase New panel. None lit shows the whole band - this is a decode log first, and a panel that opened by hiding most of the traffic would be lying about what is on the air.
This commit is contained in:
@@ -33,14 +33,22 @@ export type Decode = {
|
||||
off_air?: boolean;
|
||||
source?: string;
|
||||
instance?: string;
|
||||
dt?: number;
|
||||
audio_hz?: number;
|
||||
// Replayed verbatim when answering the station — see AnswerDecode.
|
||||
ms?: number;
|
||||
low_conf?: boolean;
|
||||
};
|
||||
|
||||
export type TxMsg = {
|
||||
msg: string;
|
||||
de_call?: string;
|
||||
dx_call?: string;
|
||||
mode?: string;
|
||||
band?: string;
|
||||
freq_hz?: number;
|
||||
instance?: string;
|
||||
transmitting?: boolean;
|
||||
at: string;
|
||||
};
|
||||
|
||||
@@ -60,11 +68,52 @@ type StatusEntry = {
|
||||
interface Props {
|
||||
decodes: Decode[];
|
||||
txMsgs: TxMsg[];
|
||||
// txState is the LIVE transmit state — what is going out right now and to
|
||||
// whom. Separate from txMsgs, which is the history threaded into the periods.
|
||||
txState?: TxMsg | null;
|
||||
spotStatus: Record<string, StatusEntry>;
|
||||
onCall: (d: Decode) => void;
|
||||
myCall?: string;
|
||||
}
|
||||
|
||||
// The "new" categories, as toggle badges — the same idea and the same colours as
|
||||
// the Chase New panel, so an operator who has learned one has learned both.
|
||||
//
|
||||
// All off means no filtering at all: this is a decode LOG first, and a panel
|
||||
// that starts by hiding most of the band would be lying about what is on it.
|
||||
type NewCat = 'dxcc' | 'band' | 'mode' | 'slot' | 'pfx' | 'grid' | 'pota' | 'cty';
|
||||
|
||||
const NEW_CATS: { key: NewCat; label: string; colour: string }[] = [
|
||||
{ key: 'dxcc', label: 'dec.stNew', colour: 'var(--success)' },
|
||||
{ key: 'band', label: 'dec.stBand', colour: 'var(--warning)' },
|
||||
{ key: 'mode', label: 'dec.stMode', colour: 'var(--info)' },
|
||||
{ key: 'slot', label: 'dec.stSlot', colour: 'var(--caution)' },
|
||||
{ key: 'pota', label: 'dec.bgPota', colour: markerColour('new_pota') },
|
||||
{ key: 'grid', label: 'dec.bgGrid', colour: markerColour('new_grid') },
|
||||
{ key: 'pfx', label: 'dec.bgPfx', colour: markerColour('new_pfx') },
|
||||
{ key: 'cty', label: 'dec.bgCounty', colour: markerColour('new_county') },
|
||||
];
|
||||
|
||||
// catsOf lists everything a decode is new for. A station can be several at once
|
||||
// — a new entity that is also a new park — so this is a set, not a verdict.
|
||||
function catsOf(e: StatusEntry | undefined): Set<NewCat> {
|
||||
const out = new Set<NewCat>();
|
||||
if (!e) return out;
|
||||
switch (e.status) {
|
||||
case 'new': out.add('dxcc'); break;
|
||||
case 'new-band': out.add('band'); break;
|
||||
case 'new-mode': out.add('mode'); break;
|
||||
case 'new-slot': out.add('slot'); break;
|
||||
}
|
||||
if (e.new_pota) out.add('pota');
|
||||
if (e.new_grid) out.add('grid');
|
||||
if (e.new_pfx) out.add('pfx');
|
||||
if (e.new_county) out.add('cty');
|
||||
return out;
|
||||
}
|
||||
|
||||
const CAT_KEY = 'opslog.decodeCats';
|
||||
|
||||
// DEFAULT_TR is the slot length assumed when the sender never told us its T/R
|
||||
// period. Fifteen seconds is FT8, which is the overwhelming majority of what
|
||||
// arrives here; a wrong guess only mis-groups, it never loses a decode.
|
||||
@@ -78,7 +127,7 @@ const DEFAULT_TR = 15;
|
||||
// Message is the one elastic column, with a floor so it does not collapse; the
|
||||
// slack lands there rather than between two fixed columns, which is what read as
|
||||
// a hole in the middle of every line.
|
||||
const ROW = 'grid grid-cols-[3px_120px_64px_68px_minmax(280px,1fr)_230px_180px_36px] items-stretch';
|
||||
const ROW = 'grid grid-cols-[3px_120px_58px_54px_62px_64px_minmax(240px,1fr)_222px_160px_34px] items-stretch';
|
||||
|
||||
// CELL draws the column rule. items-stretch above plus a right border here is
|
||||
// what makes the lines run unbroken from the header to the bottom of the list —
|
||||
@@ -156,11 +205,22 @@ function snrTone(snr: number): string {
|
||||
return 'text-muted-foreground/70';
|
||||
}
|
||||
|
||||
export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Props) {
|
||||
export function DecodesPanel({ decodes, txMsgs, txState, spotStatus, onCall, myCall }: Props) {
|
||||
const { t } = useI18n();
|
||||
const [cqOnly, setCqOnly] = useState(false);
|
||||
const [newOnly, setNewOnly] = useState(false);
|
||||
const [lotwOnly, setLotwOnly] = useState(false);
|
||||
const [cats, setCats] = useState<Set<NewCat>>(() => {
|
||||
try {
|
||||
const raw = JSON.parse(localStorage.getItem(CAT_KEY) || '[]');
|
||||
return new Set(Array.isArray(raw) ? raw : []);
|
||||
} catch { return new Set(); }
|
||||
});
|
||||
const toggleCat = (k: NewCat) => setCats((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (next.has(k)) next.delete(k); else next.add(k);
|
||||
try { localStorage.setItem(CAT_KEY, JSON.stringify([...next])); } catch { /* not worth failing over */ }
|
||||
return next;
|
||||
});
|
||||
const [bandSel, setBandSel] = useState('');
|
||||
const [modeSel, setModeSel] = useState('');
|
||||
const [contSel, setContSel] = useState('');
|
||||
@@ -188,9 +248,6 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [decodes, spotStatus]);
|
||||
|
||||
const isNewSomething = (e: StatusEntry | undefined): boolean =>
|
||||
!!e && ((!!e.status && e.status !== 'worked') || !!e.new_county || !!e.new_pota || !!e.new_pfx || !!e.new_grid);
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
const q = search.trim().toUpperCase();
|
||||
const floor = minSnr.trim() === '' ? null : parseInt(minSnr, 10);
|
||||
@@ -201,13 +258,20 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
if (floor != null && Number.isFinite(floor) && d.snr < floor) return false;
|
||||
const e = statusOf(d);
|
||||
if (lotwOnly && !e?.lotw) return false;
|
||||
if (newOnly && !isNewSomething(e)) return false;
|
||||
// Any badge lit narrows the list to the things it names; none lit shows
|
||||
// the band as it is.
|
||||
if (cats.size > 0) {
|
||||
const have = catsOf(e);
|
||||
let hit = false;
|
||||
for (const c of cats) if (have.has(c)) { hit = true; break; }
|
||||
if (!hit) return false;
|
||||
}
|
||||
if (contSel && e?.continent !== contSel) return false;
|
||||
if (q && !(d.call.includes(q) || (d.grid ?? '').toUpperCase().includes(q) || (d.msg ?? '').toUpperCase().includes(q))) return false;
|
||||
return true;
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [decodes, spotStatus, cqOnly, newOnly, lotwOnly, bandSel, modeSel, contSel, minSnr, search]);
|
||||
}, [decodes, spotStatus, cqOnly, lotwOnly, cats, bandSel, modeSel, contSel, minSnr, search]);
|
||||
|
||||
// Group into periods, newest first, and drop the operator's transmissions into
|
||||
// the slot they went out in.
|
||||
@@ -221,10 +285,15 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
}
|
||||
for (const m of txMsgs) {
|
||||
const k = periodStart(m.at, DEFAULT_TR);
|
||||
// Only into a period the list is actually showing — a transmission alone
|
||||
// in an empty slot would be a section with nothing to read.
|
||||
const g = by.get(k);
|
||||
if (g) g.tx.push(m);
|
||||
// A transmit slot CREATES its period when there is none.
|
||||
//
|
||||
// This is the whole alternation, and getting it wrong hid the feature
|
||||
// completely: FT8 transmits and receives in opposite slots, so the period
|
||||
// you were sending in is exactly the one with no decodes in it. Dropping
|
||||
// the message when its period was empty meant it never appeared at all.
|
||||
let g = by.get(k);
|
||||
if (!g) { g = { decodes: [], tx: [] }; by.set(k, g); }
|
||||
g.tx.push(m);
|
||||
}
|
||||
return [...by.entries()]
|
||||
.sort((a, b) => b[0] - a[0])
|
||||
@@ -239,10 +308,12 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
}, [filtered, txMsgs]);
|
||||
|
||||
const resetFilters = () => {
|
||||
setCqOnly(false); setNewOnly(false); setLotwOnly(false); setBandSel('');
|
||||
setCqOnly(false); setLotwOnly(false); setBandSel('');
|
||||
setModeSel(''); setContSel(''); setMinSnr(''); setSearch('');
|
||||
setCats(new Set());
|
||||
try { localStorage.setItem(CAT_KEY, '[]'); } catch { /* not worth failing over */ }
|
||||
};
|
||||
const anyFilter = cqOnly || newOnly || lotwOnly || !!bandSel || !!modeSel || !!contSel || !!minSnr || !!search.trim();
|
||||
const anyFilter = cqOnly || lotwOnly || cats.size > 0 || !!bandSel || !!modeSel || !!contSel || !!minSnr || !!search.trim();
|
||||
|
||||
const sel = 'h-8 rounded-lg border border-border bg-background px-2 text-sm';
|
||||
const chip = (on: boolean, tone = 'primary') => cn(
|
||||
@@ -266,13 +337,32 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
<button type="button" className={chip(cqOnly, 'success')} onClick={() => setCqOnly((v) => !v)}>
|
||||
{t('dec.cqOnly')}
|
||||
</button>
|
||||
<button type="button" className={chip(newOnly)} onClick={() => setNewOnly((v) => !v)}>
|
||||
{t('dec.newOnly')}
|
||||
</button>
|
||||
<button type="button" className={chip(lotwOnly)} onClick={() => setLotwOnly((v) => !v)}>
|
||||
{t('dec.lotwOnly')}
|
||||
</button>
|
||||
|
||||
{/* Per-category badges, in the colours of the flags they select — the
|
||||
same vocabulary as the Chase New panel. */}
|
||||
<span className="flex items-center gap-1 pl-1 border-l border-border/60 ml-1" title={t('dec.catsHint')}>
|
||||
{NEW_CATS.map((c) => {
|
||||
const on = cats.has(c.key);
|
||||
return (
|
||||
<button
|
||||
key={c.key}
|
||||
type="button"
|
||||
onClick={() => toggleCat(c.key)}
|
||||
className={cn(
|
||||
'rounded border px-1.5 py-0.5 text-[11px] font-bold uppercase tracking-wide transition-all',
|
||||
on ? 'border-transparent' : 'border-border text-muted-foreground opacity-50 hover:opacity-100',
|
||||
)}
|
||||
style={on ? { color: c.colour, borderColor: c.colour } : undefined}
|
||||
>
|
||||
{t(c.label)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</span>
|
||||
|
||||
{/* Only when there is a choice to make — see the memo above. */}
|
||||
{bands.length > 1 && (
|
||||
<select className={sel} value={bandSel} onChange={(e) => setBandSel(e.target.value)}>
|
||||
@@ -332,12 +422,47 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* ── What I am sending, and to whom ─────────────────────────── */}
|
||||
{/*
|
||||
Its own strip rather than a line in the list: it is the one thing on this
|
||||
screen that is about the operator and not about the band, and while a
|
||||
period scrolls away this stays put. It appears as soon as a Status
|
||||
arrives, so it says who is being called even on a sender that never
|
||||
reports its transmit text.
|
||||
*/}
|
||||
{txState && (txState.msg || txState.dx_call) && (
|
||||
<div className={cn('flex items-center gap-3 px-3 py-2 shrink-0 border-b',
|
||||
txState.transmitting ? 'bg-primary/15 border-primary/40' : 'bg-muted/40 border-border')}>
|
||||
<span className={cn('inline-flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-wider shrink-0',
|
||||
txState.transmitting ? 'text-primary' : 'text-muted-foreground')}>
|
||||
{txState.transmitting && <span className="size-2 rounded-full bg-primary animate-pulse" />}
|
||||
{txState.transmitting ? t('dec.txNow') : t('dec.txIdle')}
|
||||
</span>
|
||||
{txState.msg
|
||||
? <span className="font-mono text-base font-semibold text-foreground truncate">{txState.msg}</span>
|
||||
: <span className="text-sm text-muted-foreground italic">{t('dec.txUnknown')}</span>}
|
||||
{txState.dx_call && (
|
||||
<span className="flex items-center gap-1.5 shrink-0">
|
||||
<span className="text-xs text-muted-foreground uppercase tracking-wider">{t('dec.working')}</span>
|
||||
<span className="font-mono text-base font-bold text-warning">{txState.dx_call}</span>
|
||||
</span>
|
||||
)}
|
||||
<span className="flex-1" />
|
||||
{txState.band && <span className="text-xs text-muted-foreground shrink-0">{txState.band}</span>}
|
||||
{txState.instance && instances.length > 1 && (
|
||||
<span className="text-xs text-muted-foreground shrink-0">{txState.instance}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ── Column header ──────────────────────────────────────────── */}
|
||||
<div className="shrink-0 border-b border-border bg-background">
|
||||
<div className={cn(ROW, 'h-8 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground')}>
|
||||
<span />
|
||||
<span className={CELL}>{t('dec.colCall')}</span>
|
||||
<span className={cn(CELL, 'justify-end')}>{t('dec.colSnr')}</span>
|
||||
<span className={cn(CELL, 'justify-end')} title={t('dec.colDtTitle')}>{t('dec.colDt')}</span>
|
||||
<span className={cn(CELL, 'justify-end')} title={t('dec.colFreqTitle')}>{t('dec.colFreq')}</span>
|
||||
<span className={CELL}>{t('dec.colGrid')}</span>
|
||||
<span className={CELL}>{t('dec.colMsg')}</span>
|
||||
<span className={CELL}>{t('dec.colFlags')}</span>
|
||||
@@ -421,6 +546,21 @@ export function DecodesPanel({ decodes, txMsgs, spotStatus, onCall, myCall }: Pr
|
||||
{d.snr > 0 ? `+${d.snr}` : d.snr}
|
||||
</span>
|
||||
|
||||
{/* DT — how far into the slot the transmission started. Past
|
||||
about ±2 s a station is drifting out of the window, so the
|
||||
figure earns a warning tint rather than staying grey. */}
|
||||
<span className={cn(CELL, 'justify-end font-mono text-xs tabular-nums',
|
||||
Math.abs(d.dt ?? 0) > 2 ? 'text-warning' : 'text-muted-foreground')}>
|
||||
{d.dt == null ? '' : d.dt.toFixed(1)}
|
||||
</span>
|
||||
|
||||
{/* The audio offset inside the passband, which is what WSJT-X
|
||||
calls Freq — not the RF frequency, which is the same for
|
||||
every station in the list and would say nothing. */}
|
||||
<span className={cn(CELL, 'justify-end font-mono text-xs text-muted-foreground tabular-nums')}>
|
||||
{d.audio_hz ?? ''}
|
||||
</span>
|
||||
|
||||
<span className={cn(CELL, 'font-mono text-xs text-muted-foreground')}>
|
||||
{d.grid ?? ''}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user