From fc302bbf97ec675fd8ffe36b75e03a7f9b5549f4 Mon Sep 17 00:00:00 2001 From: Kennan LeJeune Date: Sat, 25 Sep 2021 17:06:02 -0400 Subject: [PATCH] add a data usage widget --- src/lib/types/index.ts | 4 +- src/lib/widgets/UsageInformation.svelte | 60 +++++++++++++++++++++++++ src/routes/overview.svelte | 26 ++++++----- 3 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 src/lib/widgets/UsageInformation.svelte diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 18d302f..10f8786 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -73,7 +73,7 @@ export interface ApnCfg { X_ALU_COM_IPAddressV6: string; } -export interface CellularStat { +export interface UsageStats { BytesReceived: number; BytesSent: number; } @@ -135,7 +135,7 @@ export interface CellCAStatsCfg { export interface NetworkStatusResponse { connection_status: ConnectionStatus[]; apn_cfg: ApnCfg[]; - cellular_stats: CellularStat[]; + cellular_stats: UsageStats[]; ethernet_stats: EthernetStat[]; cell_5G_stats_cfg: Cell5GStatsCfg[]; cell_LTE_stats_cfg: CellLTEStatsCfg[]; diff --git a/src/lib/widgets/UsageInformation.svelte b/src/lib/widgets/UsageInformation.svelte new file mode 100644 index 0000000..f18c416 --- /dev/null +++ b/src/lib/widgets/UsageInformation.svelte @@ -0,0 +1,60 @@ + + + +
+ {#if online} + + {:else} + + {/if} +
+
diff --git a/src/routes/overview.svelte b/src/routes/overview.svelte index e26e392..e0813d9 100644 --- a/src/routes/overview.svelte +++ b/src/routes/overview.svelte @@ -1,5 +1,5 @@