Skip to content

Commit be13308

Browse files
fhirschmannclaude
andcommitted
feat: blinking connection-lost icon instead of toast
Replace the 'connection to ESPuino lost' warning toast with a blinking icon next to the OK indicator in the navbar. The icon appears when no pong is received within 5s and is hidden again as soon as the connection is back (pong received or socket reconnected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f6c3f4e commit be13308

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ neon logo that doubles as the SVG favicon ([`8d9725c`](../../commit/8d9725c)):
6868
| Full backup: export/import of all settings + RFID assignments as JSON, WiFi credentials optional | [`7f2e4ae`](../../commit/7f2e4ae) |
6969
| Equalizer profiles: dropdown presets (Flat / Music / Audiobook-Speech / Deep voices / Custom) on top of the 3-band tone control; speech presets cut bass and lift mids/highs so deep narrator voices stay intelligible, persisted in NVS. Profiles can also be assigned per file or directory (right-click in the file browser) — e.g. set the speech profile for all Bibi Blocksberg episodes at once. The active profile can be cycled with the bindable command **154** (button/RFID modifier) and set/reported via the MQTT topic `equalizer` (`flat`/`music`/`speech`/`voiceBoost`) | [`300b9dd`](../../commit/300b9dd) |
7070
| Blinking "OK" indicator next to the battery replaces the generic "action successful" toast | [`0870ccc`](../../commit/0870ccc) |
71+
| Blinking "connection lost" icon in the navbar replaces the connection-lost toast | [`c45402b`](../../commit/c45402b) |
7172
| Play/pause button in the RFID tab plays the highlighted file/folder (and pauses running playback) | [`8d3d196`](../../commit/8d3d196) |
7273
| Cyberpunk footer below the interface (neon "LEO INDUSTRIES // DIVISION: AUDIO" branding) | [`c21f8bf`](../../commit/c21f8bf) |
7374
| SD card cleanup: removes macOS metadata (`.DS_Store`, `._*`, Spotlight/Trashes) with one click | [`5f38a51`](../../commit/5f38a51) |

html/management.html

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,25 @@
261261
100% { opacity: 0; }
262262
}
263263

264+
/* blinking "connection lost" icon next to the OK indicator (replaces the conlost toast) */
265+
#connLost {
266+
display: none;
267+
color: var(--cp-magenta);
268+
font-size: .95rem;
269+
margin-right: 12px;
270+
text-shadow: 0 0 10px rgba(255, 42, 109, .8);
271+
}
272+
273+
#connLost.show {
274+
display: inline;
275+
animation: conn-blink 1s steps(1) infinite;
276+
}
277+
278+
@keyframes conn-blink {
279+
0%, 49% { opacity: 1; }
280+
50%, 100% { opacity: .15; }
281+
}
282+
264283
/* ---------- dropdown menu ---------- */
265284
.dropdown-menu {
266285
background: var(--cp-panel);
@@ -1148,6 +1167,7 @@
11481167
<span id="navbar-heading" data-i18n="title"></span>
11491168
</a>
11501169
<div class="collapse navbar-collapse justify-content-end">
1170+
<span class="navbar-text" id="connLost" data-i18n="[title]toast.conlost"><i class="fas fa-link-slash"></i></span>
11511171
<span class="navbar-text" id="actionOk" aria-hidden="true"><i class="fas fa-check"></i> OK</span>
11521172
<span class="navbar-text" id="batteryIndicator" data-visible="false">
11531173
<i class="fas fa-battery-three-quarters" id="batteryIcon"></i><span id="batteryLevel"></span>
@@ -3486,6 +3506,9 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
34863506
} function connect() {
34873507
socket = new WebSocket("ws://" + host + "/ws");
34883508
socket.onopen = function () {
3509+
// connection (re)established -> hide the "connection lost" indicator
3510+
var connLostEl = document.getElementById('connLost');
3511+
if (connLostEl) connLostEl.classList.remove('show');
34893512
clearInterval(pingInterval);
34903513
clearInterval(getTrackProgressInterval);
34913514
pingInterval = setInterval(ping, 3000);
@@ -4115,12 +4138,17 @@ <h5 class="modal-title" data-i18n="tools.nvs.erase.title"></h5>
41154138
var myJSON = JSON.stringify(myObj);
41164139
socket.send(myJSON);
41174140
tm = setTimeout(function () {
4118-
toaster.warning(i18next.t("toast.conlost"));
4141+
// no pong within 5s -> show the blinking "connection lost" icon (was a toast)
4142+
var el = document.getElementById('connLost');
4143+
if (el) el.classList.add('show');
41194144
}, 5000);
41204145
}
41214146

41224147
function pong() {
41234148
clearTimeout(tm);
4149+
// pong received -> connection is alive again, hide the indicator
4150+
var el = document.getElementById('connLost');
4151+
if (el) el.classList.remove('show');
41244152
}
41254153
async function getTrackProgress() {
41264154
if (ActiveTab !== 'nav-control-tab') {

0 commit comments

Comments
 (0)