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( > - -