From 014f438d83598a2a1da6cc1849209627175cb9f6 Mon Sep 17 00:00:00 2001 From: Jos Nienhuis <6952249+joszz@users.noreply.github.com> Date: Thu, 26 Nov 2026 08:40:29 +0100 Subject: [PATCH] fix(ui): on a phone the menu's fetched line is the refresh button #768 put Refresh at the right end of the menu's "Fetched" line, while every other icon there sits on the left. On a phone the whole line is now the button: its turning icon stays in the icon column with the others, in the accent colour, and the line gets a soft rounded ground, 40 px tall, that brightens under a press. Off a phone it stays a plain line and the footer keeps its Refresh button. - useRefresh holds what the footer button and the line share: offered only with the server reachable, held back while a refresh runs or no car is chosen. - The line reads "Refresh (fetched 08:34)" to a screen reader (control.refreshFetched, in every locale). - The #sidebar-refresh landing spot and the Teleport into it are gone; the line is v-if again. Co-Authored-By: Claude Opus 5.5 --- frontend/src/App.vue | 58 +++++++++------ frontend/src/__tests__/App.spec.ts | 72 +++++++++++++++++-- frontend/src/assets/main.css | 19 +++-- frontend/src/assets/shell.css | 36 +++++++--- frontend/src/components/AppFooter.vue | 49 +++++-------- .../components/__tests__/AppFooter.spec.ts | 8 +-- .../composables/__tests__/useRefresh.spec.ts | 62 ++++++++++++++++ frontend/src/composables/useRefresh.ts | 27 +++++++ frontend/src/locales/en.json | 1 + frontend/src/locales/es.json | 1 + frontend/src/locales/nl.json | 1 + frontend/src/locales/pt-PT.json | 1 + frontend/src/locales/pt.json | 1 + 13 files changed, 251 insertions(+), 85 deletions(-) create mode 100644 frontend/src/composables/__tests__/useRefresh.spec.ts create mode 100644 frontend/src/composables/useRefresh.ts diff --git a/frontend/src/App.vue b/frontend/src/App.vue index d284e545..a7401706 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -21,6 +21,9 @@ import { useGatewayStatus } from '@/composables/useGatewayStatus' import { useSettledAvailability } from '@/composables/useSettledAvailability' import { useFavicon } from '@/composables/useFavicon' import { usePageTitle } from '@/composables/usePageTitle' +import { useRefresh } from '@/composables/useRefresh' +import { useMediaQuery } from '@/composables/useMediaQuery' +import { PHONE_MEDIA_QUERY } from '@/utils/viewport' import { useScreenWakeLock } from '@/composables/useScreenWakeLock' import { usePhoneGpsRecorder } from '@/composables/usePhoneGpsRecorder' import { useRelativeTime } from '@/composables/useRelativeTime' @@ -182,6 +185,18 @@ const lastFetched = computed(() => { return formatTime(d) }) +// On a phone, where the footer and its Refresh button are hidden, the menu's "Fetched" line asks +// the car for fresh data itself, its turning icon in the place the other lines have theirs. +const { canRefresh, refreshing, disabled: refreshDisabled, refresh } = useRefresh() +const isPhone = useMediaQuery(PHONE_MEDIA_QUERY) +const refreshFromMenu = computed(() => isPhone.value && canRefresh.value) +const refreshLineAttrs = computed(() => ({ + type: 'button', + disabled: refreshDisabled.value, + title: t('control.refresh'), + 'aria-label': t('control.refreshFetched', { time: lastFetched.value }), +})) + const lastRecorded = computed(() => { const ts = vehicleStore.currentStatus?.recordedAt if (!ts) return null @@ -374,27 +389,30 @@ watch( > - -