feat(chase): the switches follow the operator, not the panel

Chase POTA, US counties, prefixes and grids were written for the cluster
and stayed there, so an operator who does not chase parks still met NEW
POTA in the FT decode list and in Chase new: the same badge withdrawn on
one screen and shouting on the next. The setting is about what is hunted.

One helper answers the question for every panel, keyed by both the status
field names and the shorter category names so a single call serves badges
and filter chips alike. Chase new also stops CATEGORISING a row by a
marker that is switched off, which had left rows listed with no visible
reason for being there. A new US state has no switch of its own, so it is
always allowed.
This commit is contained in:
2026-09-01 16:20:28 +02:00
parent f39bda110a
commit b70a679c64
4 changed files with 37 additions and 8 deletions
+9 -4
View File
@@ -12,6 +12,7 @@ import { useEffect, useMemo, useState } from 'react';
import { Radar, Loader2, X } from 'lucide-react';
import { formatDistance } from '@/lib/units';
import { useI18n } from '@/lib/i18n';
import { chaseAllows } from '@/lib/spotDisplay';
import { markerColour } from '@/lib/spotMarkers';
import { cn } from '@/lib/utils';
import { GetChaseNewSpots } from '../../wailsjs/go/main/App';
@@ -60,6 +61,10 @@ const CATEGORIES: Array<{ key: Category; labelKey: string; colour: string }> = [
];
// categoryOf is the single thing a row says about a station.
//
// A category the operator does not chase is not a category here either: with
// prefixes and squares switched off this panel showed rows whose only reason
// for being listed had been withdrawn everywhere else.
function categoryOf(s: ChaseNewSpot): Category | null {
switch (s.status) {
case 'new': return 'dxcc';
@@ -68,8 +73,8 @@ function categoryOf(s: ChaseNewSpot): Category | null {
case 'new-mode': return 'mode';
case 'new-slot': return 'slot';
}
if (s.new_pfx) return 'pfx';
if (s.new_grid) return 'grid';
if (s.new_pfx && chaseAllows('pfx')) return 'pfx';
if (s.new_grid && chaseAllows('grid')) return 'grid';
return null;
}
@@ -83,7 +88,7 @@ function loadFilters(): Set<Category> {
if (Array.isArray(list)) return new Set(list);
}
} catch { /* a corrupt preference is not worth a broken panel */ }
return new Set(CATEGORIES.map((c) => c.key));
return new Set(CATEGORIES.filter((c) => chaseAllows(c.key)).map((c) => c.key));
}
export function ChaseNewPanel({ onPick, onClose }: Props) {
@@ -132,7 +137,7 @@ export function ChaseNewPanel({ onPick, onClose }: Props) {
{/* Filters, in the same order and colours as the badges they hide. */}
<div className="flex flex-1 flex-wrap items-center gap-1">
{CATEGORIES.map((c) => (
{CATEGORIES.filter((c) => chaseAllows(c.key)).map((c) => (
<button
key={c.key}
type="button"