From 03c97fc5cff7921e5c2a688fc7eb318082c12596 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Mon, 24 Nov 2025 17:13:48 +0100 Subject: [PATCH 01/10] Fix for band filter changed when band band is changed by CAT --- assets/js/sections/bandmap_list.js | 80 +++++++++++++++++------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 767fda665..90d38bd01 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -2285,6 +2285,7 @@ $(function() { window.isCatTrackingEnabled = isCatTrackingEnabled; // Expose to window for cat.js var currentRadioFrequency = null; // Store current radio frequency in kHz var lastGradientFrequency = null; // Track last frequency used for gradient update + var lastRadioBand = null; // Store last valid band from radio frequency updates // Three-state CAT control: 'off', 'on', 'on+marker' var catState = 'off'; @@ -2453,6 +2454,10 @@ $(function() { const band = frequencyToBand(data.frequency); // Store current radio frequency (convert Hz to kHz) currentRadioFrequency = data.frequency / 1000; + // Store last valid band from radio (used when entering purple mode) + if (band && band !== '') { + lastRadioBand = band; + } // Bandmap-specific: Update band filter only in purple mode if (isFrequencyMarkerEnabled) { @@ -2487,31 +2492,19 @@ $(function() { } } } + + // Call cat.js's original updateCATui for standard CAT UI updates (purple mode only) + if (typeof catJsUpdateCATui === 'function') { + catJsUpdateCATui(data); + } else { + console.warn('Bandmap: cat.js updateCATui not available'); + } } // Update frequency gradient colors for all visible rows (works in both normal and purple CAT modes) if (isCatTrackingEnabled) { updateFrequencyGradientColors(); } - - // Call cat.js's original updateCATui for standard CAT UI updates - if (typeof catJsUpdateCATui === 'function') { - - // Store current band selection before calling cat.js updateCATui - const bandBeforeUpdate = $("#band").val(); - - catJsUpdateCATui(data); - - // Restore the band selection unless we're in purple mode - // (cat.js updateCATui automatically sets band based on frequency, but we only want that in purple mode) - if (!window.isFrequencyMarkerEnabled && bandBeforeUpdate) { - $("#band").val(bandBeforeUpdate); - updateSelectCheckboxes('band'); - syncQuickFilterButtons(); - } - } else { - console.warn('Bandmap: cat.js updateCATui not available'); - } }; $.fn.dataTable.moment(custom_date_format + ' HH:mm'); @@ -3240,24 +3233,41 @@ $(function() { case 'on': // ON → ON+MARKER (Purple Mode) window.isFrequencyMarkerEnabled = true; - catState = 'on+marker'; // Purple mode: disable controls and set filter to current band - disableBandFilterControls(); + catState = 'on+marker'; + disableBandFilterControls(); - if (window.lastCATData && window.lastCATData.frequency) { - const band = frequencyToBand(window.lastCATData.frequency); - if (band && band !== '') { - $("#band").val([band]); - updateSelectCheckboxes('band'); - syncQuickFilterButtons(); - // Force reload to fetch only the active band from backend - applyFilters(true); - } - updateFrequencyGradientColors(); - } - lockTableSortingToFrequency(); + // Always ensure single band filter in purple mode + const currentBands = $("#band").val() || []; + let targetBand = null; - updateButtonVisual('on+marker'); - break; + // Priority 1: Use current radio band (already calculated and stored from radio updates) + if (lastRadioBand && lastRadioBand !== '') { + targetBand = lastRadioBand; + } else if (currentRadioFrequency) { + // Priority 2: Calculate from current radio frequency + targetBand = frequencyToBand(currentRadioFrequency * 1000); // Convert kHz back to Hz + } else if (currentBands.length === 1 && !currentBands.includes('All')) { + // Priority 3: Keep current selection if single + targetBand = currentBands[0]; + } else { + // Priority 4: Default to 20m as last resort fallback + targetBand = '20m'; + } + + // Set to single band + $("#band").val([targetBand]); + updateSelectCheckboxes('band'); + syncQuickFilterButtons(); + // Force reload to fetch only the active band from backend + applyFilters(true); + + if (window.lastCATData && window.lastCATData.frequency) { + updateFrequencyGradientColors(); + } + lockTableSortingToFrequency(); + + updateButtonVisual('on+marker'); + break; case 'on+marker': // ON+MARKER → ON (Exit Purple Mode) From a75dc9869c0da3ec6918b4ad1dd757e3249b62a1 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 17:46:51 +0100 Subject: [PATCH 02/10] Fix for radio status box --- assets/js/cat.js | 3 +++ assets/js/sections/bandmap_list.js | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/assets/js/cat.js b/assets/js/cat.js index d623e2813..ecc6e5bc4 100644 --- a/assets/js/cat.js +++ b/assets/js/cat.js @@ -684,6 +684,9 @@ $(document).ready(function() { } } + // Expose displayRadioStatus globally for bandmap and other components + window.displayRadioStatus = displayRadioStatus; + /** * Process CAT data and update UI elements * Performs timeout check, updates form fields, and displays radio status diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 90d38bd01..c21cff012 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -2450,6 +2450,9 @@ $(function() { // Override updateCATui to add bandmap-specific behavior window.updateCATui = function(data) { + // Store last CAT data globally for other components (same as cat.js does) + window.lastCATData = data; + // Determine band from frequency const band = frequencyToBand(data.frequency); // Store current radio frequency (convert Hz to kHz) @@ -2492,13 +2495,11 @@ $(function() { } } } + } - // Call cat.js's original updateCATui for standard CAT UI updates (purple mode only) - if (typeof catJsUpdateCATui === 'function') { - catJsUpdateCATui(data); - } else { - console.warn('Bandmap: cat.js updateCATui not available'); - } + // Display radio status when CAT is enabled (don't call full catJsUpdateCATui as it updates QSO form fields) + if (isCatTrackingEnabled && typeof window.displayRadioStatus === 'function') { + window.displayRadioStatus('success', data); } // Update frequency gradient colors for all visible rows (works in both normal and purple CAT modes) From 9f7b6f29dac3a0a16a1bfe8e814fba6239dde3c6 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 18:06:48 +0100 Subject: [PATCH 03/10] Fix for radio info div --- assets/js/sections/bandmap_list.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index c21cff012..55eb5a4c4 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -2015,6 +2015,8 @@ $(function() { btn.removeClass('btn-success').addClass('btn-secondary'); isCatTrackingEnabled = false; window.isCatTrackingEnabled = false; + window.isFrequencyMarkerEnabled = false; + catState = 'off'; // Show offline status instead of just hiding if (typeof window.displayOfflineStatus === 'function') { @@ -2029,6 +2031,12 @@ $(function() { // Unlock table sorting unlockTableSorting(); + // Clear frequency gradient colors and purple mode indicators + clearFrequencyGradientColors(); + + // Reset button visual to OFF state + updateButtonVisual('off'); + // Reset band filter to 'All' and fetch all bands const currentBands = $("#band").val() || []; if (currentBands.length !== 1 || currentBands[0] !== 'All') { From ac500bd05c8bc1d142f3b93cb599ada9997b805f Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 18:17:53 +0100 Subject: [PATCH 04/10] Update when polling turned on --- assets/js/sections/bandmap_list.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 55eb5a4c4..952b78e6b 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -3227,10 +3227,16 @@ $(function() { window.isCatTrackingEnabled = true; catState = 'on'; + // Display last known data if available if (window.lastCATData && typeof window.displayRadioStatus === 'function') { window.displayRadioStatus('success', window.lastCATData); } + // Trigger immediate polling update if using polling radio + if (selectedRadio !== 'ws' && typeof updateFromCAT === 'function') { + updateFromCAT(); + } + // In normal mode: only show gradient, don't change filters or disable controls if (window.lastCATData && window.lastCATData.frequency) { updateFrequencyGradientColors(); From d6f871523f40b03e2066973ec0612ac1628d71f8 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 18:43:16 +0100 Subject: [PATCH 05/10] Fix for missplaced data in columns --- assets/js/sections/bandmap_list.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 952b78e6b..c32ede4be 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -1250,6 +1250,11 @@ $(function() { $(this).attr('title', lang_click_to_prepare_logging); }); + // Apply responsive column visibility after rendering + if (typeof handleResponsiveColumns === 'function') { + handleResponsiveColumns(); + } + // Initialize tooltips with error handling try { $('[data-bs-toggle="tooltip"]').each(function() { @@ -3355,13 +3360,13 @@ $(function() { * * Column indices (0-based): * 0: Age, 1: Band, 2: Frequency, 3: Mode, 4: Submode, 5: Callsign, 6: Continent, 7: CQZ, - * 8: Flag, 9: Entity, 10: DXCC, 11: de Callsign, 12: de Cont, 13: de CQZ, - * 14: Last QSO, 15: Special, 16: Message + * 8: Flag, 9: Entity, 10: de Callsign, 11: de Cont, 12: de CQZ, 13: Last QSO, + * 14: Special, 15: Message * * Breakpoints: * - Full screen or > 1374px: Show all columns - * - <= 1374px: Hide DXCC (10), CQZ (7), de CQZ (13), Last QSO (14), Submode (4) - * - <= 1294px: Additionally hide Band (1), Cont (6), de Cont (12) + * - <= 1374px: Hide CQZ (7), de CQZ (12), Last QSO (13), Submode (4) + * - <= 1294px: Additionally hide Band (1), Cont (6), de Cont (11) * - <= 1024px: Additionally hide Flag (8) * - <= 500px: Show only Age (0), Freq (2), Callsign (5), Entity (9) */ From ec506d8ce5d83fcd74197362faa412f272990fc3 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 18:47:43 +0100 Subject: [PATCH 06/10] Fix for very narrow screens --- assets/js/sections/bandmap_list.js | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index c32ede4be..89bf9dfbc 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -3415,6 +3415,7 @@ $(function() { $('.spottable th:nth-child(12), .spottable td:nth-child(12)').addClass('column-hidden'); // de Cont $('.spottable th:nth-child(13), .spottable td:nth-child(13)').addClass('column-hidden'); // de CQZ $('.spottable th:nth-child(14), .spottable td:nth-child(14)').addClass('column-hidden'); // Last QSO + $('.spottable th:nth-child(16), .spottable td:nth-child(16)').addClass('column-hidden'); // Message } else if (containerWidth <= 1294) { // Hide: CQZ, de CQZ, Last QSO, Submode, Band, Cont, de Cont $('.spottable th:nth-child(2), .spottable td:nth-child(2)').addClass('column-hidden'); // Band From f51591820e06e48175b15b92fe4140dcde0b8638 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 19:48:21 +0100 Subject: [PATCH 07/10] Fix for tooltip --- assets/js/sections/bandmap_list.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 89bf9dfbc..df3a45355 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -1245,16 +1245,18 @@ $(function() { }); } - // Add hover tooltips to all rows - $('.spottable tbody tr').each(function() { - $(this).attr('title', lang_click_to_prepare_logging); - }); - // Apply responsive column visibility after rendering if (typeof handleResponsiveColumns === 'function') { handleResponsiveColumns(); } + // Add hover tooltips to all rows + $('.spottable tbody tr').each(function() { + $(this).attr('title', lang_click_to_prepare_logging); + $(this).attr('data-bs-toggle', 'tooltip'); + $(this).attr('data-bs-placement', 'top'); + }); + // Initialize tooltips with error handling try { $('[data-bs-toggle="tooltip"]').each(function() { From e7a2ae361ce597a67342dd8e9e64417eb4341d61 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 19:51:27 +0100 Subject: [PATCH 08/10] Callsign coloring --- assets/js/sections/bandmap_list.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index df3a45355..01f2757bb 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -971,16 +971,14 @@ $(function() { } else { dxcc_wked_info = "text-danger"; } - // Color code callsign: green=confirmed, yellow=worked - if (single.cnfmd_call) { - wked_info = "text-success"; - } else if (single.worked_call) { - wked_info = "text-warning"; - } else { - wked_info = ""; - } - - // Build LoTW badge with color coding based on last upload age + // Color code callsign: green=confirmed, yellow=worked, red=new + if (single.cnfmd_call) { + wked_info = "text-success"; + } else if (single.worked_call) { + wked_info = "text-warning"; + } else { + wked_info = "text-danger"; + } // Build LoTW badge with color coding based on last upload age var lotw_badge = ''; if (single.dxcc_spotted && single.dxcc_spotted.lotw_user) { let lclass = ''; From fdda63a0f1a9b1101d1a5d38e4e28715a1f5db23 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 19:58:09 +0100 Subject: [PATCH 09/10] Fix for table resize --- assets/css/bandmap_list.css | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/assets/css/bandmap_list.css b/assets/css/bandmap_list.css index fbfc4580b..8beb90fd4 100644 --- a/assets/css/bandmap_list.css +++ b/assets/css/bandmap_list.css @@ -421,13 +421,24 @@ table tbody tr.cat-nearest-above td { text-align: center; } +/* Responsive: At medium screens where Message is hidden, Entity fills remaining space */ +@media (max-width: 1094px) and (min-width: 501px) { + .spottable { + table-layout: auto !important; + } + .spottable th:nth-child(10), .spottable td:nth-child(10) { + width: 100% !important; + min-width: 150px !important; + } +} + /* Responsive: On smallest screens, Entity column fills remaining space */ @media (max-width: 500px) { .spottable { table-layout: auto !important; } .spottable th:nth-child(10), .spottable td:nth-child(10) { - width: auto !important; + width: 100% !important; min-width: 150px !important; } .spottable th:nth-child(1), .spottable td:nth-child(1) { width: 50px !important; } /* Age */ From a75cf13854b5954f14bd2b2578f176c1880d88c1 Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Tue, 25 Nov 2025 20:38:50 +0100 Subject: [PATCH 10/10] Further error proofing --- assets/js/cat.js | 6 ++++++ assets/js/sections/bandmap_list.js | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assets/js/cat.js b/assets/js/cat.js index ecc6e5bc4..95ec23bea 100644 --- a/assets/js/cat.js +++ b/assets/js/cat.js @@ -745,6 +745,12 @@ $(document).ready(function() { } } + // Validate that we have frequency data before proceeding + if (!data.frequency || data.frequency == 0 || data.frequency == null) { + console.warn('CAT: No valid frequency data received'); + return; + } + // Force update by clearing catValue (prevents cat2UI from blocking updates) $frequency.removeData('catValue'); cat_updating_frequency = true; // Set flag before CAT update diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 01f2757bb..3a5a98fb8 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -1698,9 +1698,11 @@ $(function() { if (cachedSpot && cachedSpot.band) { shouldDecrementTTL = (cachedSpot.band === bandForAPI); } - } if (shouldDecrementTTL) { - newTTL = ttl - 1; // Decrement only if in scope of this fetch - } + } + + if (shouldDecrementTTL) { + newTTL = ttl - 1; // Decrement only if in scope of this fetch + } if (newSpotKeys.has(key)) { newTTL = 1; // Reset to 1 if spot still exists (keeps it valid)