This commit is contained in:
2026-06-13 16:17:58 +02:00
parent ff53831be4
commit 00cab6b204
4 changed files with 78 additions and 37 deletions
+16 -6
View File
@@ -1294,9 +1294,15 @@ export default function App() {
email: details.email,
};
applyAwardRefs(payload, details.award_refs ?? '', awardFieldRef.current);
const loggedCall = String(payload.callsign ?? '');
const loggedDxcc = typeof payload.dxcc === 'number' ? payload.dxcc : 0;
await AddQSO(payload);
resetEntry();
await refresh();
// Refresh the Worked-before matrix so the just-logged band/mode flips to
// "worked" — resetEntry cleared it, so re-fetch for the logged call (a
// live DB query, so it now includes this QSO).
if (loggedCall.length >= 3) runWorkedBefore(loggedCall, loggedDxcc);
} catch (e: any) {
setError(String(e?.message ?? e));
} finally { setSaving(false); }
@@ -1556,6 +1562,11 @@ export default function App() {
setDetails((d) => ({ ...d, award_refs: refs.map((r) => `POTA@${r}`).join(';') }));
}
function onCallsignInput(v: string, opts?: { force?: boolean }) {
// Programmatic call-sets (force: spot click, UDP, external app) count as
// "not manually typed", so a later UDP DX call (DXHunter remote control) can
// still replace it. Without this, clicking a cluster spot froze the call:
// applyUdpCall saw current != lastUdpCall and refused every later UDP call.
if (opts?.force) lastUdpCallRef.current = v.trim().toUpperCase();
// No-op guard: external apps (MSHV/WSJT-X) re-broadcast the same DX call
// on every status packet. If it matches what's already in the entry,
// do nothing — otherwise we'd re-run the QRZ lookup, hit the cache and
@@ -1567,13 +1578,12 @@ export default function App() {
// Recording START happens on blur (leaving the callsign field), NOT here —
// you may type a call and work it minutes later. Clearing it cancels.
if (v.trim() === '') { QSOAudioCancel(); setRecording(false); recordingCallRef.current = ""; }
const wasEmpty = callsign.trim() === '';
const isEmpty = v.trim() === '';
if (wasEmpty && !isEmpty && !locks.start) {
// First keystroke of a new QSO — freeze the start time so it doesn't
// drift even if the lookup or typing takes 30 seconds. Skip when
// start is locked: the user is back-entering a past QSO and set a
// specific time manually.
if (!isEmpty && !locks.start) {
// Restart the start time on every callsign change (each keystroke, a
// clicked spot, a new call): "Start UTC" should mark when you actually
// began this contact, not a stale time frozen at the first keystroke.
// Skip when start is locked (back-entering a past QSO at a chosen time).
setQsoStartedAt(new Date());
} else if (isEmpty && !locks.start) {
// Callsign wiped → user abandoned this QSO; reset the timer.