feat(entry): NEW badge on the county in the entry strip
The same answer the Details tab already gave, moved to where the county is now typed — a badge in a tab nobody has open while working a station is a badge that does not do its job. Debounced at 300 ms and keyed on state + county together: the field is typed into as well as filled by the lookup, and the check queries the log. A county name means nothing without its state, so both have to settle before asking.
This commit is contained in:
+18
-1
@@ -91,7 +91,7 @@ import { ShutdownProgress } from '@/components/ShutdownProgress';
|
|||||||
import { ClusterGrid } from '@/components/ClusterGrid';
|
import { ClusterGrid } from '@/components/ClusterGrid';
|
||||||
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
|
import { cleanSpotter, inferSpotMode, spotModeCategory, spotStatusKey } from '@/lib/spot';
|
||||||
import { applySpotDisplay, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
import { applySpotDisplay, readSpotDisplayOptions, spotIsWorked, SPOT_DISPLAY_OPTIONS_EXPOSED } from '@/lib/spotDisplay';
|
||||||
import { GetRowColors, GetSpotTTLMinutes } from '../wailsjs/go/main/App';
|
import { GetRowColors, GetSpotTTLMinutes, IsNewUSCounty } from '../wailsjs/go/main/App';
|
||||||
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
import { WorkedBeforeGrid } from '@/components/WorkedBeforeGrid';
|
||||||
import { NetControlPanel } from '@/components/NetControlPanel';
|
import { NetControlPanel } from '@/components/NetControlPanel';
|
||||||
import { ContestPanel, CONTEST_DEFAULT, type ContestSession } from '@/components/ContestPanel';
|
import { ContestPanel, CONTEST_DEFAULT, type ContestSession } from '@/components/ContestPanel';
|
||||||
@@ -4459,6 +4459,23 @@ export default function App() {
|
|||||||
// A numeric field stores undefined when cleared, not 0: zero is a real DXCC
|
// A numeric field stores undefined when cleared, not 0: zero is a real DXCC
|
||||||
// number for "no entity" and a real answer for a zone, so an empty box must
|
// number for "no entity" and a real answer for a zone, so an empty box must
|
||||||
// stay empty rather than assert something.
|
// stay empty rather than assert something.
|
||||||
|
// NEW badge on the county — the same answer the Details tab gives, moved to
|
||||||
|
// where the county is now typed. Debounced: this field is typed into as well
|
||||||
|
// as filled by the lookup, and the check hits the database.
|
||||||
|
const [entryNewCounty, setEntryNewCounty] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
const cnty = (details.cnty ?? '').trim();
|
||||||
|
if (!cnty) { setEntryNewCounty(false); return; }
|
||||||
|
let alive = true;
|
||||||
|
const id = window.setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
const isNew = await IsNewUSCounty(details.state ?? '', cnty);
|
||||||
|
if (alive) setEntryNewCounty(!!isNew);
|
||||||
|
} catch { if (alive) setEntryNewCounty(false); }
|
||||||
|
}, 300);
|
||||||
|
return () => { alive = false; window.clearTimeout(id); };
|
||||||
|
}, [details.state, details.cnty]);
|
||||||
|
|
||||||
const num = (v: string): number | undefined => {
|
const num = (v: string): number | undefined => {
|
||||||
const s = v.replace(/[^0-9]/g, '');
|
const s = v.replace(/[^0-9]/g, '');
|
||||||
return s === '' ? undefined : parseInt(s, 10);
|
return s === '' ? undefined : parseInt(s, 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user