diff --git a/web/pages/components/statistic.tsx b/web/pages/components/statistic.tsx index abe51849b..91cc5209d 100644 --- a/web/pages/components/statistic.tsx +++ b/web/pages/components/statistic.tsx @@ -1,25 +1,55 @@ -import { Statistic, Card, Col} from "antd"; +import { Typography, Statistic, Card, Col, Progress} from "antd"; +const { Text, Link } = Typography; interface ItemProps { title: string, value: string, prefix: JSX.Element, + color: string, + progress: boolean, }; export default function StatisticItem(props: ItemProps) { const { title, value, prefix } = props; - const valueStyle = { color: "#334", fontSize: "1.8rem" }; + const View = props.progress ? ProgressView : StatisticView; return ( - +
+ +
); +} + +function ProgressView({title, value, prefix, color}) { + const endColor = value > 90 ? 'red' : color; + const content = ( +
+ {prefix} +
{title}
+
{value}%
+
+ ) + return ( + content} /> + ) +} + +function StatisticView({title, value, prefix}) { + const valueStyle = { color: "#334", fontSize: "1.8rem" }; + + return ( + + ) } \ No newline at end of file diff --git a/web/pages/hardware-info.tsx b/web/pages/hardware-info.tsx index 9688421ea..3bb3206cb 100644 --- a/web/pages/hardware-info.tsx +++ b/web/pages/hardware-info.tsx @@ -76,19 +76,25 @@ const series = [

Hardware Info

} + title="CPU" + value={`${currentCPUUsage}`} + prefix={} + color="#FF7700" + progress /> } + title="RAM" + value={`${currentRamUsage}`} + prefix={} + color="#004777" + progress /> } + title="Disk" + value={`${currentDiskUsage}`} + prefix={} + color="#A9E190" + progress />