From a2fb105ad94198bd342aa4586b742439e1a60083 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 23:49:41 +0100 Subject: dashboard: move messages toggle to the legend row --- src/api/dashboard/dashboard.html | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/api/dashboard/dashboard.html') diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index 784fdb6..3236973 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -120,6 +120,9 @@ .legend .dot-size { display: inline-flex; align-items: center; gap: 4px; } .legend .dot-size::before { display: none; } .legend .dot-size input { width: 6em; height: 1em; margin: 0; } + /* After the slider, as tall; the kinds and the slider greyed while the dots are off. */ + .legend button.toggle { float: none; margin-left: 0; line-height: 1em; } + .legend.off .message, .legend.off .dot-size { opacity: .45; } #legends { flex: none; } /* Hides the legend, and shows it again. */ button.toggle { font: inherit; font-size: 12px; text-transform: none; letter-spacing: 0; @@ -190,8 +193,7 @@

Swarm - -

+
this node @@ -202,7 +204,8 @@ in focus (click a node)
-
+
drag to pan, wheel or pinch to zoom, turn with two fingers; drag a node to move it, double-click it to pin it there or let it go @@ -1580,22 +1583,25 @@ const kindColour = kind => (KIND_COLOURS.find(([name]) => kind === name || let dotScale = 2; try { dotScale = Number(localStorage.getItem("continuum-dot-scale")) || 2; } catch (_) {} dotScale = Math.min(4, Math.max(1.25, dotScale)); +let dotSlider = null; function showMessagesLegend() { const legend = document.getElementById("messages-legend"); - legend.hidden = !flowsShown; - if (legend.childElementCount === 0) { - const slider = el("input", { type: "range", min: "1.25", max: "4", step: ".25", + legend.classList.toggle("off", !flowsShown); + if (dotSlider === null) { + const slider = dotSlider = el("input", { type: "range", min: "1.25", max: "4", step: ".25", title: "How large the dots are" }); slider.value = String(dotScale); slider.addEventListener("input", () => { dotScale = Number(slider.value); try { localStorage.setItem("continuum-dot-scale", String(dotScale)); } catch (_) {} }); - legend.append(...KIND_COLOURS.map(([kind, colour]) => + // Before the toggle, which ends the line. + legend.prepend(...KIND_COLOURS.map(([kind, colour]) => el("span", { class: "message", style: "--colour: " + colour }, kind === "paths" ? "paths (pings)" : kind)), el("label", { class: "dot-size" }, "size", slider)); } + dotSlider.disabled = !flowsShown; } showMessagesLegend(); // A dot's radius for a message of `bytes`: grows with the size's logarithm, from 1.5 -- cgit v1.3.1