feat: sort band columns by wavelength instead of alphabetically
Band columns are now sorted by wavelength (longest to shortest): 160m, 80m, 60m, 40m, 30m, 20m, 17m, 15m, 12m, 10m, 6m, 2m, 70cm, SAT. Unknown bands are sorted to the end. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
// Get available modes from entities
|
||||
$: availableModes = ['Mixed Mode', ...new Set(entities.map(e => e.mode).filter(Boolean).sort())];
|
||||
|
||||
// Band order by wavelength (longest to shortest), SAT at the end
|
||||
const bandOrder = ['160m', '80m', '60m', '40m', '30m', '20m', '17m', '15m', '12m', '10m', '6m', '2m', '70cm', 'SAT', '23cm', '13cm', '9cm', '6cm', '3cm'];
|
||||
|
||||
// Filter entities by selected mode for summary calculations
|
||||
$: filteredEntities = selectedMode === 'Mixed Mode'
|
||||
? entities
|
||||
@@ -167,9 +170,15 @@
|
||||
}
|
||||
})
|
||||
.sort((a, b) => {
|
||||
// Sort by band first, then mode (if present)
|
||||
const bandCompare = (a.band || '').localeCompare(b.band || '');
|
||||
if (bandCompare !== 0) return bandCompare;
|
||||
// Sort by band order (by wavelength), then by mode
|
||||
const aBandIndex = bandOrder.indexOf(a.band);
|
||||
const bBandIndex = bandOrder.indexOf(b.band);
|
||||
const aIndex = aBandIndex === -1 ? 999 : aBandIndex;
|
||||
const bIndex = bBandIndex === -1 ? 999 : bBandIndex;
|
||||
|
||||
if (aIndex !== bIndex) return aIndex - bIndex;
|
||||
|
||||
// Same band, sort by mode if present
|
||||
if (a.mode !== undefined && b.mode !== undefined) {
|
||||
return (a.mode || '').localeCompare(b.mode || '');
|
||||
}
|
||||
@@ -258,8 +267,15 @@
|
||||
}
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const bandCompare = (a.band || '').localeCompare(b.band || '');
|
||||
if (bandCompare !== 0) return bandCompare;
|
||||
// Sort by band order (by wavelength), then by mode
|
||||
const aBandIndex = bandOrder.indexOf(a.band);
|
||||
const bBandIndex = bandOrder.indexOf(b.band);
|
||||
const aIndex = aBandIndex === -1 ? 999 : aBandIndex;
|
||||
const bIndex = bBandIndex === -1 ? 999 : bBandIndex;
|
||||
|
||||
if (aIndex !== bIndex) return aIndex - bIndex;
|
||||
|
||||
// Same band, sort by mode if present
|
||||
if (a.mode !== undefined && b.mode !== undefined) {
|
||||
return (a.mode || '').localeCompare(b.mode || '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user