fix: bandmap opened or closed is now persistent over restart

This commit is contained in:
2026-06-20 18:59:12 +02:00
parent 95d37da3bb
commit 4a6ea45665
2 changed files with 9 additions and 3 deletions
+8 -3
View File
@@ -685,7 +685,12 @@ export default function App() {
}, []);
// Single band map docked beside the table (toggled by the toolbar button,
// visible across tabs). Independent of the multi-band "Band Map" tab.
const [showBandMap, setShowBandMap] = useState(false);
const [showBandMap, setShowBandMap] = useState(() => localStorage.getItem('bandmap.show') === '1');
// Persist the Band Map open/closed state (portable) so it survives a restart.
const setBandMapShown = useCallback((v: boolean) => {
setShowBandMap(v);
writeUiPref('bandmap.show', v ? '1' : '0');
}, []);
const [bandMapSide, setBandMapSide] = useState<'left' | 'right'>(
() => (localStorage.getItem('bandmap.side') === 'left' ? 'left' : 'right'),
);
@@ -2879,7 +2884,7 @@ export default function App() {
<Button
variant={showBandMap ? 'default' : 'outline'}
size="sm"
onClick={() => setShowBandMap((v) => !v)}
onClick={() => setBandMapShown(!showBandMap)}
title="Toggle a single band map docked on the side (use the Band Map tab for several at once)"
className="h-8"
>
@@ -3642,7 +3647,7 @@ export default function App() {
spotStatus={spotStatus}
currentFreqHz={band && freqMhz ? Math.round(parseFloat(freqMhz) * 1_000_000) : 0}
onSpotClick={handleSpotClick}
onClose={() => setShowBandMap(false)}
onClose={() => setBandMapShown(false)}
/>
</div>
)}