From 57dc0aadd7bd3272f3122ab724f192df358e9fb2 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 8 Mar 2022 22:15:56 +0000 Subject: [PATCH] Add build info --- VoidCat/spa/src/GlobalStats.css | 15 +++++++++++ VoidCat/spa/src/GlobalStats.js | 46 +++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/VoidCat/spa/src/GlobalStats.css b/VoidCat/spa/src/GlobalStats.css index 68fce18..2797caa 100644 --- a/VoidCat/spa/src/GlobalStats.css +++ b/VoidCat/spa/src/GlobalStats.css @@ -18,8 +18,23 @@ margin: 0 10px; font-size: 14px; } + .stats svg { height: 16px; width: 16px; } + + .build-info { + width: 100vw; + } +} + +.build-info { + position: fixed; + left: 0; + bottom: 0; + color: #888; + text-align: center; + font-size: x-small; + padding: 10px; } \ No newline at end of file diff --git a/VoidCat/spa/src/GlobalStats.js b/VoidCat/spa/src/GlobalStats.js index bcdad91..58ad0cc 100644 --- a/VoidCat/spa/src/GlobalStats.js +++ b/VoidCat/spa/src/GlobalStats.js @@ -1,9 +1,10 @@ -import {useEffect, useState} from "react"; +import {Fragment, useEffect, useState} from "react"; import FeatherIcon from "feather-icons-react"; import {FormatBytes} from "./Util"; import "./GlobalStats.css"; import {useApi} from "./Api"; +import moment from "moment"; export function GlobalStats(props) { const {Api} = useApi(); @@ -19,23 +20,30 @@ export function GlobalStats(props) { useEffect(() => loadStats(), []); return ( -
-
- - {FormatBytes(stats?.bandwidth?.ingress ?? 0, 2)} -
-
- - {FormatBytes(stats?.bandwidth?.egress ?? 0, 2)} -
-
- - {FormatBytes(stats?.totalBytes ?? 0, 2)} -
-
- - {stats?.count ?? 0} -
-
+ +
+
+ + {FormatBytes(stats?.bandwidth?.ingress ?? 0, 2)} +
+
+ + {FormatBytes(stats?.bandwidth?.egress ?? 0, 2)} +
+
+ + {FormatBytes(stats?.totalBytes ?? 0, 2)} +
+
+ + {stats?.count ?? 0} +
+
+ {stats.buildInfo ?
+ {stats.buildInfo.version}-{stats.buildInfo.gitHash} +
+ {moment(stats.buildInfo.buildTime).fromNow()} +
: null} +
); } \ No newline at end of file