From 944493a56e81750e0f1bda82cec9ed16f8e56acd Mon Sep 17 00:00:00 2001 From: MarekWo Date: Tue, 21 Jul 2026 20:50:11 +0200 Subject: [PATCH] feat(pathanalyzer): collapsible filter panel on small screens On viewports below 768px the toolbar collapses to a single line (view switcher + Filters toggle + counter); filters expand on demand and an active-filter count badge shows on the toggle when collapsed. Desktop layout is unchanged (the panel renders with display: contents). Frees most of the vertical space for the path list on the mobile Map view. Co-Authored-By: Claude Fable 5 --- app/static/js/path-analyzer.js | 9 +++ app/templates/path-analyzer.html | 114 +++++++++++++++++++++---------- 2 files changed, 86 insertions(+), 37 deletions(-) diff --git a/app/static/js/path-analyzer.js b/app/static/js/path-analyzer.js index 824b5a1..c8f1212 100644 --- a/app/static/js/path-analyzer.js +++ b/app/static/js/path-analyzer.js @@ -849,6 +849,15 @@ function paReadFilters() { paFilters.sender = document.getElementById('paSenderFilter').value.trim().toLowerCase(); paFilters.content = document.getElementById('paContentFilter').value.trim().toLowerCase(); document.getElementById('paClearFiltersBtn').classList.toggle('d-none', !paFiltersActive()); + + // Active-filter count on the mobile Filters toggle, so filters applied + // while the panel is collapsed stay visible + const activeCount = [paFilters.hops !== 'any', paFilters.hashSize !== 'any', + paFilters.token !== '', paFilters.sender !== '', + paFilters.content !== ''].filter(Boolean).length; + const badge = document.getElementById('paFiltersBadge'); + badge.textContent = activeCount; + badge.classList.toggle('d-none', activeCount === 0); } function paApplyFilters() { diff --git a/app/templates/path-analyzer.html b/app/templates/path-analyzer.html index 17b6c05..0af29d5 100644 --- a/app/templates/path-analyzer.html +++ b/app/templates/path-analyzer.html @@ -57,6 +57,38 @@ flex-shrink: 0; } + /* Collapsible filter group. On >=768px it renders as if its children + sat directly in the toolbar (display: contents), so the desktop + layout is unchanged and the collapse state is ignored. Below 768px + it is a Bootstrap collapse spanning the full toolbar width, + toggled by the Filters button. Keep these rules on the class (not + the #id) so Bootstrap's .collapse:not(.show) still wins. */ + .pa-filters { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem; + } + + @media (min-width: 768px) { + .pa-filters { + display: contents !important; + } + } + + @media (max-width: 767.98px) { + .pa-filters { + width: 100%; + order: 10; /* keep the counter on the first toolbar line */ + } + + .pa-filters input.form-control { + flex: 1 1 42%; + width: auto !important; + min-width: 0; + } + } + .pa-content { flex: 1 1 0; min-height: 0; @@ -474,44 +506,52 @@ Map -
- - - -
- - - - - - +
+
+ + + +
+ + + + + + +