feat(system-resources-widget): add label display mode option (#4086)

This commit is contained in:
Meier Lukas authored and GitHub committed 2025-09-19 16:19:58 +02:00
1 parent 2a67d2f9da
commit 312e084e2c
8 files changed
+108 -14

No files matched your search

@@ -1,11 +1,21 @@
import { Paper, Text } from "@mantine/core";
import { IconArrowDown, IconArrowUp } from "@tabler/icons-react";
import { humanFileSize } from "@homarr/common";
import { useScopedI18n } from "@homarr/translation/client";
import type { LabelDisplayModeOption } from "..";
import { CommonChart } from "./common-chart";
export const NetworkTrafficChart = ({ usageOverTime, isUp }: { usageOverTime: number[]; isUp: boolean }) => {
export const NetworkTrafficChart = ({
usageOverTime,
isUp,
labelDisplayMode,
}: {
usageOverTime: number[];
isUp: boolean;
labelDisplayMode: LabelDisplayModeOption;
}) => {
const chartData = usageOverTime.map((usage, index) => ({ index, usage }));
const t = useScopedI18n("widget.systemResources.card");
@@ -18,8 +28,10 @@ export const NetworkTrafficChart = ({ usageOverTime, isUp }: { usageOverTime: nu
dataKey={"index"}
series={[{ name: "usage", color: "yellow.5" }]}
title={isUp ? t("up") : t("down")}
icon={isUp ? IconArrowUp : IconArrowDown}
yAxisProps={{ domain: [0, upperBound] }}
lastValue={`${humanFileSize(Math.round(max))}/s`}
labelDisplayMode={labelDisplayMode}
tooltipProps={{
content: ({ payload }) => {
if (!payload) {