From 7cd5f2b47daa962baf1e667ba7c17fcfcd3f1c0e Mon Sep 17 00:00:00 2001 From: Jos Nienhuis <6952249+joszz@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:05:32 +0100 Subject: [PATCH] fix(ui): phone header polish: no empty dashboard row, a clearer period, info in the top bar - On a touch phone the dashboard's title row showed nothing: the title is in the top bar, a long press replaces Edit layout and the top bar's refresh button spins. The empty row and its gap are hidden, so the first card starts 12 px under the top bar instead of 68 px. A row that still has a caption or a visible action stays, so the statistics keep their period and filters. Any phone row left with nothing in it is hidden as well. - The period (Statistics, Map, Trip log, Charge history, trip editor) reads as what the whole page shows: semibold, in the text colour, behind a calendar in the accent colour, instead of a muted line. - The heading and its info button form one block. On a phone both go to the top bar, the info button as a small mark raised off the heading's top right. On a desktop it sits right beside the heading. Co-Authored-By: Claude Opus 5.5 --- frontend/src/assets/editMode.css | 15 +++++++ frontend/src/assets/main.css | 15 +++---- frontend/src/assets/shell.css | 35 ++++++++++++++- frontend/src/components/ViewHeader.vue | 44 +++++++++++-------- .../components/__tests__/ViewHeader.spec.ts | 20 +++++++-- 5 files changed, 95 insertions(+), 34 deletions(-) diff --git a/frontend/src/assets/editMode.css b/frontend/src/assets/editMode.css index 87a5713b..e316d845 100644 --- a/frontend/src/assets/editMode.css +++ b/frontend/src/assets/editMode.css @@ -226,6 +226,21 @@ } } +/* On a touch phone the dashboard's title row can hold nothing that shows: the title is in the top + bar, a long press takes the place of Edit layout, and the top bar's refresh button spins for + the refresh. Such a row gives its height and gap back to the cards. A row with a caption or any + other action, such as the statistics' period and filters, stays. */ +@media (width <= 767px) and (hover: none) and (pointer: coarse) { + .view-header:has(.edit-layout-btn):not( + :has( + .view-header__caption, + .view-header__actions > :not(.refresh-indicator, .edit-layout-btn--touch-hidden) + ) + ) { + display: none; + } +} + .edit-mode-bar-enter-active, .edit-mode-bar-leave-active { transition: diff --git a/frontend/src/assets/main.css b/frontend/src/assets/main.css index fd706415..8ebef6f6 100644 --- a/frontend/src/assets/main.css +++ b/frontend/src/assets/main.css @@ -1019,8 +1019,8 @@ body, padding-inline: 0.65rem; } - /* The heading has gone up to the top bar, so the row keeps the caption, the info button and the - actions, all on one middle. */ + /* The heading and its info button have gone up to the top bar, so the row keeps the caption and + the actions, on one middle. */ .view-header { align-items: center; } @@ -1029,14 +1029,9 @@ body, margin: 0; } - .view-header__info { - width: var(--touch-target); - height: var(--touch-target); - } - - /* First in its row, its icon starts on the cards' left edge. */ - .view-header__info:first-child { - margin-left: calc((1rem - var(--touch-target)) / 2); + /* With no caption and no actions left, the row would be an empty band above the first card. */ + .view-header:not(:has(.view-header__caption, .view-header__actions > *)) { + display: none; } .sidebar-meta .app-footer__meta { diff --git a/frontend/src/assets/shell.css b/frontend/src/assets/shell.css index bf1050a0..b520a299 100644 --- a/frontend/src/assets/shell.css +++ b/frontend/src/assets/shell.css @@ -112,6 +112,20 @@ white-space: nowrap; } +/* Up here the info button is a small mark raised off the heading's top right, like a footnote + sign, so the heading keeps the bar's middle. Its hit area stays 28px, past the 24px minimum. */ +.mobile-topbar__title .view-header__title { + gap: 0; +} + +.mobile-topbar__title .view-header__info { + width: 28px; + height: 28px; + margin-left: -0.1rem; + font-size: 0.8rem; + transform: translateY(-0.55rem); +} + /* ── Backdrop ─────────────────────────────────────────────── */ .sidebar-backdrop { @@ -220,18 +234,37 @@ /* A short line under the heading inside the title row (ViewHeader's caption), such as the period Statistics shows. */ .view-header__caption { + display: flex; + align-items: center; + gap: 0.4rem; margin: 0.15rem 0 0; + color: var(--color-text); + font-weight: 600; +} + +/* The period is what the whole page shows, so it reads as such: a calendar in the accent colour + ahead of it, rather than a muted footnote. */ +.view-header__caption-icon { + color: var(--color-primary-light); +} + +/* The heading with its info button beside it: they travel together to a phone's top bar. */ +.view-header__title { + display: flex; + align-items: center; + gap: 0.25rem; + min-width: 0; } /* The button that opens the line about the page, close beside the heading and as tall as its line, so the actions keep their place on the right. */ .view-header__info { display: flex; + flex-shrink: 0; align-items: center; justify-content: center; width: var(--page-title-height); height: var(--page-title-height); - margin-left: -0.5rem; padding: 0; border: none; border-radius: 6px; diff --git a/frontend/src/components/ViewHeader.vue b/frontend/src/components/ViewHeader.vue index 223ac31f..d2182bb6 100644 --- a/frontend/src/components/ViewHeader.vue +++ b/frontend/src/components/ViewHeader.vue @@ -3,8 +3,8 @@ // the heading inside the row (the period Statistics shows). A line about the page waits behind an // info button beside the heading. Under it all, the notice that the server cannot be reached, so // every page says so. -// A phone's top bar shows the heading in place of the app's name, which leaves the page's own row -// to the caption and the actions. +// A phone's top bar shows the heading and its info button in place of the app's name, which +// leaves the page's own row to the caption and the actions. import { ref } from 'vue' import { useI18n } from 'vue-i18n' import DetailModal from '@/components/DetailModal.vue' @@ -25,26 +25,32 @@ const aboutOpen = ref(false)