From e9fa30959b8ed25f154c4f654a8e84b5e62c17ed Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Tue, 16 Feb 2021 13:37:18 +0100 Subject: [PATCH] bandwidth --- packages/dashboard/src/pages/index.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/dashboard/src/pages/index.js b/packages/dashboard/src/pages/index.js index 1c15465f..5e07f33f 100644 --- a/packages/dashboard/src/pages/index.js +++ b/packages/dashboard/src/pages/index.js @@ -9,8 +9,6 @@ dayjs.extend(relativeTime); const apiPrefix = process.env.NODE_ENV === "development" ? "/api/stubs" : ""; const fetcher = (url) => fetch(url).then((r) => r.json()); -const currentPeriodDownload = Math.floor(Math.random() * 1000000000000) + 1; -const currentPeriodUpload = Math.floor(Math.random() * 1000000000000) + 1; export default function Home() { const { data: user } = useSWR("/user", fetcher); @@ -20,8 +18,7 @@ export default function Home() { return (
- {/* change to lg:grid-cols-3 when we have more stats */} -
+
@@ -94,7 +91,7 @@ export default function Home() {
- {/*
+
@@ -114,17 +111,21 @@ export default function Home() {
-
Current period usage
+
Bandwidth used
-
{prettyBytes(currentPeriodDownload)}
-
/
-
{prettyBytes(currentPeriodUpload)}
+
{prettyBytes(user?.bandwidthUsed ?? 0)}
-
-
*/} +
+ +
+
{/* ============ */}