fix: Sort sources alphabetically in UI for consistent display

Changed Sources list and dropdown to sort alphabetically by name instead of
dynamically by last data arrival time. This provides a stable, predictable
order that is less distracting during use.

- Modified updateSourcesLegend() in map-manager.js to sort sources by name
- Modified updateSourceFilter() in ui-manager.js to maintain consistent sorting
- Sources now use localeCompare() for proper alphabetical ordering

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-01 17:32:03 +02:00
commit 57e63975db
2 changed files with 12 additions and 3 deletions

View file

@ -199,7 +199,12 @@ export class MapManager {
legend.innerHTML = ''; legend.innerHTML = '';
for (const [id, source] of this.sourcesData) { // Sort sources alphabetically by name
const sortedSources = Array.from(this.sourcesData.values()).sort((a, b) =>
a.name.localeCompare(b.name)
);
for (const source of sortedSources) {
const item = document.createElement('div'); const item = document.createElement('div');
item.className = 'legend-item'; item.className = 'legend-item';
item.innerHTML = ` item.innerHTML = `

View file

@ -226,8 +226,12 @@ export class UIManager {
// Clear options except "All Sources" // Clear options except "All Sources"
select.innerHTML = '<option value="">All Sources</option>'; select.innerHTML = '<option value="">All Sources</option>';
// Add source options // Sort sources alphabetically by name and add options
for (const [id, source] of this.sourcesData) { const sortedSources = Array.from(this.sourcesData.entries()).sort((a, b) =>
a[1].name.localeCompare(b[1].name)
);
for (const [id, source] of sortedSources) {
const option = document.createElement('option'); const option = document.createElement('option');
option.value = id; option.value = id;
option.textContent = source.name; option.textContent = source.name;