From a2c8f07c989b7df38be784c40cae8d93c6e2118b Mon Sep 17 00:00:00 2001 From: user Date: Fri, 27 Feb 2026 02:04:41 -0800 Subject: [PATCH 1/2] feat: responsive mobile layout for monitoring dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Redesign the UI to work on mobile/portrait viewports using CSS media queries at max-width 768px: - Host rows stack vertically: info (name, latency, status) on top, sparkline chart full-width below - Summary stats line wraps properly with hidden pipe separators - Header stacks title and controls vertically - Pause button and controls sized appropriately for touch - Pin button repositioned for mobile touch targets - Footer legend wraps cleanly Desktop layout remains pixel-identical — all changes are scoped to the @media (max-width: 768px) query in styles.css only. Refs #2 --- src/styles.css | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/styles.css b/src/styles.css index 24e0fe3..600e453 100644 --- a/src/styles.css +++ b/src/styles.css @@ -21,3 +21,96 @@ body { rgba(255, 255, 255, 0) 100% ); } + +/* ---- Mobile responsive layout (portrait / narrow viewports) ---- */ +@media (max-width: 768px) { + /* Header: stack title and controls vertically */ + header .flex.items-center.justify-between { + flex-direction: column; + align-items: flex-start !important; + gap: 1rem; + } + + header .flex.flex-col.items-end { + align-items: flex-start !important; + flex-direction: row; + flex-wrap: wrap; + gap: 0.75rem; + } + + /* Pause button: smaller on mobile */ + #pause-btn { + padding: 0.5rem 1rem; + } + + #pause-btn svg { + width: 1.25rem; + height: 1.25rem; + } + + #pause-text { + font-size: 0.875rem; + } + + /* Summary box: wrap into a grid for readability */ + #summary { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 0.5rem; + justify-content: center; + line-height: 1.6; + } + + /* Hide the pipe separators on mobile */ + #summary .text-gray-600.mx-3 { + display: none; + } + + /* Host row: stack vertically */ + .host-row .flex.items-center.gap-4 { + flex-direction: column; + align-items: stretch !important; + gap: 0.5rem; + } + + /* Info section: full width, remove fixed width */ + .host-row .w-\[420px\] { + width: 100% !important; + display: grid; + grid-template-columns: 1fr auto; + align-items: center; + } + + /* Host name row with dot */ + .host-row .flex.items-center.gap-2.min-w-\[200px\] { + min-width: 0; + } + + /* Latency value: slightly smaller on mobile */ + .host-row .latency-value { + font-size: 1.875rem; + line-height: 2.25rem; + } + + /* Sparkline: full width below the info */ + .host-row .sparkline-container { + width: 100%; + flex-shrink: 0; + } + + /* Pin button: inline with the host info */ + .host-row .pin-btn { + position: absolute; + right: 0.5rem; + top: 0.5rem; + } + + .host-row { + position: relative; + } + + /* Footer legend: wrap nicely */ + footer p { + line-height: 1.8; + } +} -- 2.49.1 From 86ba1b5b5164517c37f51aa49f8cc34e637ce45a Mon Sep 17 00:00:00 2001 From: clawbot Date: Fri, 27 Feb 2026 02:08:50 -0800 Subject: [PATCH 2/2] =?UTF-8?q?remove=20mobile=20block=20=E2=80=94=20repla?= =?UTF-8?q?ced=20by=20responsive=20CSS=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mobile-block placeholder from PR #3 is no longer needed now that the UI works on mobile via CSS media queries. Ref #2 --- src/main.js | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/main.js b/src/main.js index b99a827..3ab6bb8 100644 --- a/src/main.js +++ b/src/main.js @@ -1128,42 +1128,9 @@ function handleResize(state) { // --- Bootstrap --------------------------------------------------------------- -// --- Mobile Detection -------------------------------------------------------- - -function isMobile() { - // Check both user agent and viewport width for robust detection - const uaMatch = - /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( - navigator.userAgent, - ); - const narrowViewport = window.innerWidth <= 768; - return uaMatch || narrowViewport; -} - -function buildMobileUI() { - const app = document.getElementById("app"); - app.innerHTML = ` -
-
-

NetWatch by @sneak

-

Real-time network latency monitor

-
-
-

Not yet available on mobile.

-

Please visit on a desktop browser for the full experience.

-
-
`; -} - async function init() { log.info("NetWatch starting"); - if (isMobile()) { - log.info("Mobile device detected — showing placeholder"); - buildMobileUI(); - return; - } - // Probe common gateway IPs to find the local router const gateway = await detectGateway(); const localHosts = [LOCAL_CPE]; -- 2.49.1