fix(offline): load trips from Dexie on dashboard when offline; fix offline tab i18n key

This commit is contained in:
jubnl
2026-04-14 23:34:28 +02:00
parent d3b5ca451b
commit bb3543efa6
17 changed files with 36 additions and 7 deletions
+4 -6
View File
@@ -1,6 +1,7 @@
import React, { useEffect, useState, useRef } from 'react'
import { useNavigate } from 'react-router-dom'
import { tripsApi } from '../api/client'
import { tripRepo } from '../repo/tripRepo'
import { useAuthStore } from '../store/authStore'
import { useSettingsStore } from '../store/settingsStore'
import { useTranslation } from '../i18n'
@@ -713,12 +714,9 @@ export default function DashboardPage(): React.ReactElement {
const loadTrips = async () => {
setIsLoading(true)
try {
const [active, archived] = await Promise.all([
tripsApi.list(),
tripsApi.list({ archived: 1 }),
])
setTrips(sortTrips(active.trips))
setArchivedTrips(sortTrips(archived.trips))
const { trips, archivedTrips } = await tripRepo.list()
setTrips(sortTrips(trips))
setArchivedTrips(sortTrips(archivedTrips))
} catch {
toast.error(t('dashboard.toast.loadError'))
} finally {
+1 -1
View File
@@ -42,7 +42,7 @@ export default function SettingsPage(): React.ReactElement {
{ id: 'map', label: t('settings.tabs.map') },
{ id: 'notifications', label: t('settings.tabs.notifications') },
...(hasIntegrations ? [{ id: 'integrations', label: t('settings.tabs.integrations') }] : []),
{ id: 'offline', label: t('settings.tabs.offline', 'Offline') },
{ id: 'offline', label: t('settings.tabs.offline') },
{ id: 'account', label: t('settings.tabs.account') },
...(appVersion ? [{ id: 'about', label: t('settings.tabs.about') }] : []),
]