From 0a5548cd8f35a542a5a7e005002485c1d2770620 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Thu, 3 Dec 2026 01:28:49 +0100 Subject: [PATCH] Desktop redesign after the Design canvas' Desktop artboard: search is one field in the topbar (places, the library, coordinates; / focuses it, sources and results drop down under it), the side rail is labelled (Map, Overlays, Library, Import | Route, Offline | GNSS, Live, Status at the bottom), the map's buttons in one column on the right (zoom and compass, north lock, 3D, my position, measure, note, home; measure/note panels open to the left), a status bar under the map (center coordinates to copy, the point under the mouse, zoom, scale, revision) instead of the zoom-level control, the scale on the map and the coordinates in the topbar; the base map button on the map dropped (the rail has it). Route panel reordered: points with their legs, adding one, the totals as a card, vehicle and avoid, directions and reach folded, reverse/clear/save last. Drive unchanged: the search, the status bar and the right column hide there --- public/css/style.css | 202 +++++++++++++++++++++++++++++++------------ public/js/map.js | 153 +++++++++----------------------- public/js/search.js | 51 ++++++----- views/index.erb | 60 ++++++++----- 4 files changed, 252 insertions(+), 214 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index dc4a47e..5f90600 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -6,6 +6,8 @@ blue: nothing brighter than the map). switches; Day is the default. Meanings never change between them. */ :root { + --rail: 72px; /* the labelled side rail */ + --statusbar: 24px; /* planning UI (NPS) */ --ui-bg: #ffffff; --ui-bg-2: #f0f0f0; /* hover, subtle fills */ @@ -161,7 +163,7 @@ html, body { gap: 14px; } -.topbar__coords, +.statusbar__coords, .topbar__sun { display: flex; align-items: center; @@ -193,12 +195,13 @@ html, body { height: 100%; } -.topbar__coords { +.statusbar__coords { cursor: pointer; + color: inherit; } -.topbar__coords:hover { - color: #fff; +.statusbar__coords:hover { + color: var(--ui-fg); } .topbar__sun[hidden] { @@ -438,7 +441,7 @@ html, body { } .sidebar { - flex: 0 0 52px; + flex: 0 0 var(--rail); position: relative; display: flex; flex-direction: column; @@ -450,7 +453,7 @@ html, body { /* No overflow-y:auto here: setting only one axis to a clipping value forces the browser to compute the other axis as "auto" too (CSS Overflow spec), which would clip the flyouts — they intentionally - poke out past the sidebar's own width via left:44px. */ + poke out past the sidebar's own width. */ } .sidebar-item { @@ -503,7 +506,7 @@ html, body { .sidebar-flyout { position: absolute; top: 0; - left: 44px; + left: calc(var(--rail) - 6px); z-index: 20; min-width: max-content; background: var(--ui-bg); @@ -647,10 +650,10 @@ html, body { .basemap-panel { position: fixed; top: 44px; /* below the topbar, its title in view */ - left: 52px; + left: var(--rail); width: 300px; max-width: 90vw; - bottom: 0; + bottom: var(--statusbar); display: flex; flex-direction: column; background: var(--ui-bg); @@ -670,7 +673,7 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) #ma } body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .profile-panel { - left: calc(52px + min(300px, 90vw)); + left: calc(var(--rail) + min(300px, 90vw)); } /* Phone portrait: a pinned 300px panel left the map a sliver, so there it @@ -681,7 +684,7 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr } body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .profile-panel { - left: 52px; + left: var(--rail); } /* body: outranks .gpx-panel's own rule further down */ @@ -796,7 +799,7 @@ button.basemap-panel__link[hidden] { display: none; } position: fixed; top: 44px; right: 0; - bottom: 0; + bottom: var(--statusbar); width: 300px; max-width: 90vw; background: var(--ui-bg); @@ -1074,10 +1077,10 @@ button.basemap-panel__link[hidden] { display: none; } .gpx-panel { position: fixed; top: 44px; /* below the topbar, its title in view */ - left: 52px; + left: var(--rail); width: 300px; max-width: 90vw; - bottom: 0; + bottom: var(--statusbar); display: flex; flex-direction: column; background: var(--ui-bg); @@ -1524,8 +1527,8 @@ button.basemap-panel__link[hidden] { display: none; } .measure-panel { position: absolute; top: 0; - left: 100%; - margin-left: 8px; + right: 100%; + margin-right: 8px; z-index: 20; min-width: max-content; background: var(--ui-bg); @@ -1632,28 +1635,50 @@ button.basemap-panel__link[hidden] { display: none; } color: var(--ui-fg); } +/* The search field in the topbar, its sources and results dropping down + under it (search.js). */ +.topbar__search { + flex: 0 1 460px; + min-width: 0; +} + .search-ctrl { position: relative; } -.search-ctrl__button svg { - display: block; - margin: 0 auto; - width: 18px; - height: 18px; +.search-panel__form { + display: flex; + align-items: center; + gap: 8px; + height: 32px; + padding: 0 10px; + border-radius: 8px; + background: rgb(255 255 255 / 0.12); + color: #ddd; } -.search-ctrl__button.active { - background: var(--accent-bg); +.search-ctrl__icon svg { + display: block; + width: 16px; + height: 16px; +} + +.search-ctrl__key { + font: 12px inherit; + padding: 0 6px; + border: 1px solid rgb(255 255 255 / 0.25); + border-radius: 4px; + color: #bbb; } .search-panel { position: absolute; - top: 0; - left: 100%; - margin-left: 8px; - z-index: 20; - width: 240px; + top: 100%; + left: 0; + right: 0; + margin-top: 6px; + z-index: 30; + min-width: 300px; background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 6px; @@ -1673,17 +1698,22 @@ button.basemap-panel__link[hidden] { display: none; } } .search-panel__input { - width: 100%; - box-sizing: border-box; - border: 1px solid var(--ui-line); - border-radius: 4px; - padding: 5px 7px; - font: inherit; + flex: 1; + min-width: 0; + border: none; + background: none; + color: #fff; + font: 14px inherit; + outline: none; +} + +.search-panel__input::placeholder { + color: #aaa; } .search-panel__results { list-style: none; - margin: 6px 0 0; + margin: 0; padding: 0; flex: 1 1 auto; min-height: 0; @@ -1709,7 +1739,7 @@ button.basemap-panel__link[hidden] { display: none; } display: flex; flex-wrap: wrap; gap: 2px 10px; - margin-top: 6px; + margin-bottom: 6px; font-size: 12px; color: var(--ui-fg); } @@ -1761,8 +1791,8 @@ button.basemap-panel__link[hidden] { display: none; } .notes-panel { position: absolute; top: 0; - left: 100%; - margin-left: 8px; + right: 100%; + margin-right: 8px; z-index: 20; width: 200px; background: var(--ui-bg); @@ -2034,18 +2064,6 @@ button.basemap-panel__link[hidden] { display: none; } color: #fff; } -.zoom-level-ctrl__value { - width: 29px; - height: 29px; - display: flex; - align-items: center; - justify-content: center; - font-size: 12px; - font-weight: 600; - color: var(--ui-fg); - user-select: none; -} - .pitch-toggle-ctrl__button { width: 29px; height: 29px; @@ -2427,9 +2445,9 @@ button.basemap-panel__link[hidden] { display: none; } .profile-panel { position: fixed; - left: 52px; + left: var(--rail); right: 0; - bottom: 0; + bottom: var(--statusbar); max-height: 45vh; display: flex; flex-direction: column; @@ -2775,6 +2793,13 @@ button.basemap-panel__link[hidden] { display: none; } font-weight: 600; } +/* the totals as a card (empty: no route yet, no card) */ +.route-panel__summary:not(:empty) { + padding: 8px 10px; + border-radius: 8px; + background: var(--ui-bg-2); +} + .route-panel__points { margin: 0 0 8px; padding: 0; @@ -2878,10 +2903,19 @@ button.basemap-panel__link[hidden] { display: none; } display: none; } -.route-panel__directions { +.route-panel__directions, +.route-panel__fold { margin-bottom: 8px; } +.route-panel__fold summary { + cursor: pointer; +} + +.route-panel__fold .route-panel__reach { + margin-top: 6px; +} + .route-panel__directions ol { margin: 6px 0 0; padding-left: 20px; @@ -3539,7 +3573,9 @@ html.driving .basemap-panel, html.driving .gpx-panel, html.driving .trail-panel, html.driving .profile-panel, -html.driving #map .maplibregl-ctrl-top-left { display: none; } +html.driving #map .maplibregl-ctrl-top-right > :not(.maplibregl-ctrl-overview-map), +html.driving .topbar__search, +html.driving .statusbar { display: none; } .drive-bar { position: absolute; left: 12px; @@ -3705,3 +3741,61 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; } } .drive-trip__log button.drive-trip__log--on { background: var(--route-driven); color: #fff; } .drive-trip__log-state { flex: 1; color: var(--route-driven); font-weight: 600; font-size: 15px; } + +/* The side rail, labelled (map.js sets data-label), and the status bar + under the map — the Design canvas' Desktop. */ +.sidebar-icon { + width: calc(var(--rail) - 8px); + height: 52px; + flex-direction: column; + gap: 3px; +} + +.sidebar-icon::after { + content: attr(data-label); + font-size: 10px; + font-weight: 600; + line-height: 1; +} + +.statusbar { + flex: 0 0 var(--statusbar); + display: flex; + align-items: center; + gap: 18px; + padding: 0 12px; + border-top: 1px solid var(--ui-line); + background: var(--ui-bg-2); + color: var(--ui-muted); + font-size: 12px; + font-variant-numeric: tabular-nums; + white-space: nowrap; + overflow: hidden; +} + +.statusbar__scale .maplibregl-ctrl-scale { + margin: 0; + font-size: 11px; +} + +.statusbar__rev { + margin-left: auto; +} + +/* Phone: the rail's icons alone, the status bar's basics. */ +@media (max-width: 640px) { + :root { + --rail: 52px; + } + + .sidebar-icon { + height: 36px; + } + + .sidebar-icon::after, + .statusbar__cursor, + .statusbar__rev, + .search-ctrl__key { + display: none; + } +} diff --git a/public/js/map.js b/public/js/map.js index 72da5e4..f4d9360 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -142,12 +142,6 @@ class LayerToggleControl { if (open) notifySidePanelOpen(this._panel); } - // Public wrapper so a second entry point (MapLayersButton, a map corner - // control) can open/close the same panel without reaching into a - // "private" method by convention only. - toggle() { - this._togglePanel(); - } setActive(name) { this._panel.querySelectorAll(".basemap-panel__option").forEach((button) => { @@ -164,71 +158,6 @@ class LayerToggleControl { } } -// A small map-corner button (grouped with Home/zoom, see below) that's a -// second entry point to the same panel LayerToggleControl already manages -// in the page's own sidebar — matching the National Park Service's own -// map control layout, which keeps zoom/home/base-map together on the map -// rather than split between the map and a separate side rail. -class MapLayersButton { - constructor(layerToggle) { - this._layerToggle = layerToggle; - } - - onAdd() { - this._container = document.createElement("div"); - this._container.className = "maplibregl-ctrl maplibregl-ctrl-group"; - const button = document.createElement("button"); - button.type = "button"; - button.title = "Base map"; - button.setAttribute("aria-label", "Base map"); - button.innerHTML = LAYERS_ICON; - button.addEventListener("click", () => this._layerToggle.toggle()); - this._container.appendChild(button); - return this._container; - } - - onRemove() { - this._container.remove(); - } - - getDefaultPosition() { - return "top-left"; - } -} - -// A passive zoom-level readout, sitting in the same stack as the buttons -// around it — the National Park Service's own control layout has one (the -// small numbered square next to their zoom buttons). Not a button: no -// click behavior, just a live display, so it's a plain div rather than a -// +
-

Click the map to add points (or "Add to route" on a search result or a library point); drag a marker to move it.

+
    @@ -144,30 +154,10 @@
    -
    - - - -
    +

    Add a point: below, "+" on a search result or a library point, or click the map; drag a marker to move it.

    - -
    - Reach in - - - -
    -
    @@ -222,6 +212,30 @@ + +
    + Reach +
    + Reach in + + + +
    + +
    +
    + + + +