Bläddra i källkod

fix(ui): do not show a hardcoded timezone or a fake 'firmware up to date' (#583)

The router info hardcoded the timezone to Europe/Madrid and the live
empty extras defaulted firmwareUpdated=true, so a fresh install showed an
incorrect timezone and an 'up to date' firmware pill even before any data
was gathered. Use the router timezone when available and otherwise show
the empty placeholder, and hide the firmware status pill when there is no
real data (#566).

Co-authored-by: gnacho <hnacho@proton.me>
Nacho 3 månader sedan
förälder
incheckning
6872f7e68b

+ 4 - 4
app/src/components/routers/RouterInfo.tsx

@@ -61,17 +61,17 @@ export function RouterInfo({ router, extras }: { router: Router; extras?: Router
             <StatusPill tone="warn" label={t('routers.firmwareOutdated')} />
             <StatusPill tone="warn" label={t('routers.firmwareOutdated')} />
           ) : ex.firmwareUpdated ? (
           ) : ex.firmwareUpdated ? (
             <StatusPill tone="ok" label={t('routerDetail.info.updated')} />
             <StatusPill tone="ok" label={t('routerDetail.info.updated')} />
-          ) : (
+          ) : ex.firmwareAvailable ? (
             <span title={t('routers.firmwareAvailable', { version: ex.firmwareAvailable })}>
             <span title={t('routers.firmwareAvailable', { version: ex.firmwareAvailable })}>
-              <StatusPill tone="warn" label={ex.firmwareAvailable ?? ''} />
+              <StatusPill tone="warn" label={ex.firmwareAvailable} />
             </span>
             </span>
-          )}
+          ) : null}
         </span>
         </span>
       ),
       ),
     },
     },
     { label: 'Uptime', node: fmtUptime(router.uptime) },
     { label: 'Uptime', node: fmtUptime(router.uptime) },
     { label: t('routerDetail.info.lastReboot'), node: ex.lastReboot },
     { label: t('routerDetail.info.lastReboot'), node: ex.lastReboot },
-    { label: t('routerDetail.info.timezone'), node: 'Europe/Madrid' },
+    { label: t('routerDetail.info.timezone'), node: ex.timezone ?? '—' },
     {
     {
       label: t('routerDetail.info.access'),
       label: t('routerDetail.info.access'),
       node: (
       node: (

+ 2 - 0
app/src/components/routers/routerExtras.ts

@@ -99,6 +99,8 @@ export interface RouterExtras {
   flash: string
   flash: string
   ramMb: number
   ramMb: number
   bandSplit: BandSplit
   bandSplit: BandSplit
+  /** Zona horaria del router (p. ej. 'Europe/Madrid'); vacía si se desconoce. */
+  timezone?: string
   /** Tráfico actual ↓ Mbps (routers.md §③) */
   /** Tráfico actual ↓ Mbps (routers.md §③) */
   trafficNow: number
   trafficNow: number
   /** Latencia al gateway en ms (solo APs; gateway = latencia WAN vía mock) */
   /** Latencia al gateway en ms (solo APs; gateway = latencia WAN vía mock) */

+ 1 - 1
app/src/data/DataProvider.tsx

@@ -307,7 +307,7 @@ function emptyBundle(): NetPulseData {
 export const EMPTY_EXTRAS: RouterExtras = {
 export const EMPTY_EXTRAS: RouterExtras = {
   mac: '—',
   mac: '—',
   firmware: '—',
   firmware: '—',
-  firmwareUpdated: true,
+  firmwareUpdated: false,
   lastReboot: '—',
   lastReboot: '—',
   soc: '—',
   soc: '—',
   flash: '—',
   flash: '—',