diff --git a/web/src/lib/components/shared-components/status-box.svelte b/web/src/lib/components/shared-components/status-box.svelte index 31201dd4e6..1d769829cf 100644 --- a/web/src/lib/components/shared-components/status-box.svelte +++ b/web/src/lib/components/shared-components/status-box.svelte @@ -2,19 +2,18 @@ import { browser } from '$app/environment'; import { locale } from '$lib/stores/preferences.store'; import { websocketStore } from '$lib/stores/websocket'; - import { ServerInfoResponseDto, api } from '@api'; + import { api } from '@api'; import { onDestroy, onMount } from 'svelte'; import Icon from '$lib/components/elements/icon.svelte'; import { asByteUnitString } from '../../utils/byte-units'; import LoadingSpinner from './loading-spinner.svelte'; import { mdiCloud, mdiDns } from '@mdi/js'; + import { serverInfoStore } from '$lib/stores/server-info.store'; const { serverVersion, connected } = websocketStore; - let serverInfo: ServerInfoResponseDto; - $: version = $serverVersion ? `v${$serverVersion.major}.${$serverVersion.minor}.${$serverVersion.patch}` : null; - $: usedPercentage = Math.round((serverInfo?.diskUseRaw / serverInfo?.diskSizeRaw) * 100); + $: usedPercentage = Math.round(($serverInfoStore?.diskUseRaw / $serverInfoStore?.diskSizeRaw) * 100); onMount(async () => { await refresh(); @@ -23,7 +22,7 @@ const refresh = async () => { try { const { data } = await api.serverInfoApi.getServerInfo(); - serverInfo = data; + $serverInfoStore = data; } catch (e) { console.log('Error [StatusBox] [onMount]'); } @@ -44,7 +43,7 @@
Storage
- {#if serverInfo} + {#if $serverInfoStore}- {asByteUnitString(serverInfo?.diskUseRaw, $locale)} of - {asByteUnitString(serverInfo?.diskSizeRaw, $locale)} used + {asByteUnitString($serverInfoStore?.diskUseRaw, $locale)} of + {asByteUnitString($serverInfoStore?.diskSizeRaw, $locale)} used
{:else}