feat: New fit to band and hide FTx option in bandmap tab

This commit is contained in:
2026-07-05 13:29:02 +02:00
parent 8cf53a0aa2
commit 25a53e4110
3 changed files with 42 additions and 8 deletions
+21 -1
View File
@@ -839,6 +839,12 @@ export default function App() {
return next;
});
}, []);
// Global band-map-tab options (apply to every map in the tab): hide FTx/digital
// spots, and fit each map to its full band span.
const [bandMapHideFt, setBandMapHideFt] = useState(() => localStorage.getItem('opslog.bandMapHideFt') === '1');
const [bandMapFit, setBandMapFit] = useState(() => localStorage.getItem('opslog.bandMapFit') === '1');
const toggleBandMapHideFt = useCallback(() => setBandMapHideFt((v) => { const n = !v; writeUiPref('opslog.bandMapHideFt', n ? '1' : '0'); return n; }), []);
const toggleBandMapFit = useCallback(() => setBandMapFit((v) => { const n = !v; writeUiPref('opslog.bandMapFit', n ? '1' : '0'); return n; }), []);
// 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(() => localStorage.getItem('bandmap.show') === '1');
@@ -4122,7 +4128,7 @@ export default function App() {
<TabsContent value="bandmap" className="mt-0 flex flex-col min-h-0 flex-1">
<div className="flex items-center gap-1 px-3 py-1.5 border-b border-border/60 shrink-0 flex-wrap">
<span className="text-xs text-muted-foreground mr-1">Bands:</span>
<span className="text-xs text-muted-foreground mr-1">{t('bmp.bandsLabel')}</span>
{bands.map((b) => {
const on = bandMapBands.includes(b);
return (
@@ -4133,6 +4139,18 @@ export default function App() {
</button>
);
})}
<span className="ml-auto flex items-center gap-1">
<button type="button" onClick={toggleBandMapHideFt} title={t('bmp.hideFtTitle')}
className={cn('px-2 py-0.5 rounded-full border text-[11px] font-medium transition-colors',
bandMapHideFt ? 'border-primary bg-primary text-primary-foreground' : 'border-border text-muted-foreground hover:bg-muted')}>
{t('bmp.hideFt')}
</button>
<button type="button" onClick={toggleBandMapFit} title={t('bmp.fitTitle')}
className={cn('px-2 py-0.5 rounded-full border text-[11px] font-medium transition-colors',
bandMapFit ? 'border-primary bg-primary text-primary-foreground' : 'border-border text-muted-foreground hover:bg-muted')}>
{t('bmp.fitBand')}
</button>
</span>
</div>
<div className="flex-1 min-h-0 flex gap-2 p-2 overflow-x-auto">
{bandMapBands.length === 0 ? (
@@ -4148,6 +4166,8 @@ export default function App() {
currentFreqHz={band === b && freqMhz ? Math.round(parseFloat(freqMhz) * 1_000_000) : 0}
onSpotClick={handleSpotClick}
onClose={() => toggleBandMapBand(b)}
hideDigital={bandMapHideFt}
fitToBand={bandMapFit}
/>
</div>
))}