fix(watchlist): the auto-contest FIELD — the backend shipped without its UI
The wiring script died on an app.go anchor mid-run: the backend half was committed, the frontend half (the pattern field, the changed-event refresh, the i18n keys) never ran. Replayed; the field sits after Add.
This commit is contained in:
@@ -20,7 +20,9 @@ import { useI18n } from '@/lib/i18n';
|
||||
import {
|
||||
WatchlistEntries, WatchlistAdd, WatchlistRemove, WatchlistSetNotify,
|
||||
WatchlistSetContest, WatchlistWorkedSlots,
|
||||
GetWatchlistContestPattern, SetWatchlistContestPattern,
|
||||
} from '../../wailsjs/go/main/App';
|
||||
import { EventsOn } from '../../wailsjs/runtime/runtime';
|
||||
import type { ClusterSpot, SpotStatusEntry } from '@/components/ClusterGrid';
|
||||
import { inferSpotMode, spotStatusKey } from '@/lib/spot';
|
||||
|
||||
@@ -72,7 +74,18 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
|
||||
try { setEntries(((await WatchlistEntries()) ?? []) as any as WLEntry[]); }
|
||||
catch (e: any) { setError(String(e?.message ?? e)); }
|
||||
}, []);
|
||||
useEffect(() => { void refresh(); }, [refresh]);
|
||||
// Refreshed on mount, when the backend auto-adds (event), and on a slow tick
|
||||
// so last-seen and the spot counters stay honest while the tab sits open.
|
||||
useEffect(() => {
|
||||
void refresh();
|
||||
const off = EventsOn('watchlist:changed', () => { void refresh(); });
|
||||
const id = window.setInterval(() => { void refresh(); }, 30_000);
|
||||
return () => { off(); window.clearInterval(id); };
|
||||
}, [refresh]);
|
||||
// The auto-contest pattern (DXHunter's contest_prefix): spots whose call
|
||||
// contains it are added as contest entries by the backend.
|
||||
const [pattern, setPattern] = useState('');
|
||||
useEffect(() => { GetWatchlistContestPattern().then((p: string) => setPattern(p ?? '')).catch(() => {}); }, []);
|
||||
|
||||
// Live spots per entry — prefix-matched, newest first, deduped per band+mode
|
||||
// (one line per slot; the freshest spot represents it).
|
||||
@@ -191,6 +204,11 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P
|
||||
<Button size="sm" className="h-8" onClick={() => void add()} disabled={!addCall.trim()}>
|
||||
<Plus className="size-3.5" /> {t('wl.add')}
|
||||
</Button>
|
||||
<Input className="h-8 w-28 font-mono uppercase" placeholder={t('wl.patternPh')}
|
||||
title={t('wl.patternHint')}
|
||||
value={pattern}
|
||||
onChange={(e) => setPattern(e.target.value.toUpperCase())}
|
||||
onBlur={() => { void SetWatchlistContestPattern(pattern.trim()); }} />
|
||||
<div className="flex-1" />
|
||||
<div className="relative">
|
||||
<Search className="size-3.5 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground" />
|
||||
|
||||
Reference in New Issue
Block a user