diff --git a/frontend/src/components/AwardsPanel.tsx b/frontend/src/components/AwardsPanel.tsx index e096ce1..949768b 100644 --- a/frontend/src/components/AwardsPanel.tsx +++ b/frontend/src/components/AwardsPanel.tsx @@ -8,6 +8,7 @@ import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@ import { cn } from '@/lib/utils'; import { AwardEditor } from '@/components/AwardEditor'; import { useI18n } from '@/lib/i18n'; +import { writeUiPref } from '@/lib/uiPref'; type BandCount = { band: string; worked: number; confirmed: number }; type AwardRef = { @@ -195,11 +196,23 @@ export function AwardsPanel({ onEditQSO, onAwardsChanged }: { onEditQSO?: (id: n // is how award lists are published and how an operator reads a paper list; // description answers the other question — "have I worked anything in // Alicante" — which reference order scatters across the whole table. - const [refSort, setRefSort] = useState<'ref' | 'name'>('ref'); - const [refSortDir, setRefSortDir] = useState<'asc' | 'desc'>('asc'); + // Remembered through writeUiPref rather than localStorage, so the choice + // travels with a copied data/ folder like every other UI preference here. + const [refSort, setRefSort] = useState<'ref' | 'name'>( + () => (localStorage.getItem('opslog.awardRefSort') === 'name' ? 'name' : 'ref')); + const [refSortDir, setRefSortDir] = useState<'asc' | 'desc'>( + () => (localStorage.getItem('opslog.awardRefSortDir') === 'desc' ? 'desc' : 'asc')); const toggleRefSort = (k: 'ref' | 'name') => { - if (k === refSort) setRefSortDir((d) => (d === 'asc' ? 'desc' : 'asc')); - else { setRefSort(k); setRefSortDir('asc'); } + if (k === refSort) { + const d = refSortDir === 'asc' ? 'desc' : 'asc'; + setRefSortDir(d); + writeUiPref('opslog.awardRefSortDir', d); + } else { + setRefSort(k); + setRefSortDir('asc'); + writeUiPref('opslog.awardRefSort', k); + writeUiPref('opslog.awardRefSortDir', 'asc'); + } }; const filteredRefs = useMemo(() => { diff --git a/frontend/src/lib/uiPref.ts b/frontend/src/lib/uiPref.ts index 4564dd8..0d58af4 100644 --- a/frontend/src/lib/uiPref.ts +++ b/frontend/src/lib/uiPref.ts @@ -28,6 +28,8 @@ const PORTABLE_KEYS = [ 'opslog.groupDigitalSlots', // matrix + cluster: all digital modes count as ONE (DXCC-style) instead of per-mode slots 'opslog.clusterShowFilters', // cluster filter sidebar shown (tab + Main pane) 'opslog.mapBasemap', // world map basemap (light / street / satellite) + 'opslog.mapGreyline', // world map: grey line (day/night terminator) shown + 'opslog.awardRefSort', 'opslog.awardRefSortDir', // award reference table: sort column and direction // Cluster filter selections — restored on reopen. 'opslog.clusterFilterSource', 'opslog.clusterGroup', 'opslog.clusterBands', 'opslog.clusterLockBand', 'opslog.clusterLockMode', 'opslog.clusterStatusFilter',