From fbab148382db262c1ee4181d8dcefa8e38dabd82 Mon Sep 17 00:00:00 2001 From: "Valentin V. Bartenev" Date: Mon, 11 May 2026 01:01:02 +0300 Subject: [PATCH] Web: rework preset UX Change the radio preset endpoint from https://api.meshcore.nz/api/v1/config to https://api.vbart.ru/meshcore-firmware/v1/conf.json, which returns a flat JSON array of city objects: [{"code":"BSK","name":"Biysk","timezone":"...","settings":{...}}, ...] Adapt preset parsing to the new schema: pass entry.settings through normalizeRadioConfig() at the map step so invalid or missing settings fields are silently filtered out via filter(Boolean). radioSignature() and formatRadioConfig() are simplified to operate directly on already- normalized numbers, using JS default number-to-string to avoid trailing zeros (62.5 instead of 62.500, 869 instead of 869.000). Rework the preset UX: - Remove the auto-matching logic that highlighted the current radio in the dropdown; many cities share identical radio settings so it is impossible to reliably determine which preset is active. The dropdown now starts at "Load from preset". - When a preset is selected, preview it in the "Current Radio" field (relabelled "Selected radio preset") and show "Click Save to apply". If the selected preset matches the current radio settings, the Save button is not activated and the UI is left unchanged. - After a successful apply, set radioSettingsChanged=true and show a persistent "reboot required" warning; relabel the field "New radio". - Disable the Save button (with opacity + cursor feedback) until a preset is chosen; savebtn:hover suppressed while disabled. - Reset the preset dropdown when the radio config is refreshed from the device. - Update placeholder to "Loading..." to match the new display format. - Remove now-unused "Preset" label row from the Radio Settings card. --- src/helpers/web/WebPanelServer.cpp | 100 +++++++++++------------------ 1 file changed, 39 insertions(+), 61 deletions(-) diff --git a/src/helpers/web/WebPanelServer.cpp b/src/helpers/web/WebPanelServer.cpp index 65b359a7..5f107214 100644 --- a/src/helpers/web/WebPanelServer.cpp +++ b/src/helpers/web/WebPanelServer.cpp @@ -436,7 +436,8 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( .iconbtn { width:44px; padding:12px 0; } .placeholder-slot { display:block; width:44px; height:44px; } .savebtn { width:100%; background:var(--accent); color:var(--button-text); border:none; } - .savebtn:hover { background:var(--accent-hover); } + .savebtn:not(:disabled):hover { background:var(--accent-hover); } + .savebtn:disabled { opacity:0.45; cursor:not-allowed; } .broker-stack { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr); gap:12px; align-items:start; } .broker-group { display:grid; gap:8px; align-content:start; } .broker-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; } @@ -749,13 +750,12 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(

Radio Settings

-
- +
- +
@@ -1012,7 +1012,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(