feat: polish release v2 experience (#6800)
This commit is contained in:
1 parent
925b0fb801
commit
a4a903d7c3
295 files changed
+10627
-7115
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { Box, Group, Stack, Text } from "@mantine/core";
|
||||
import { IconNetwork } from "@tabler/icons-react";
|
||||
|
||||
import { formatByteRate } from "@homarr/common";
|
||||
import { useByteFormatter } from "@homarr/settings";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { LabelDisplayModeOption } from "..";
|
||||
@@ -27,29 +27,20 @@ export const CombinedNetworkTrafficChart = ({
|
||||
down: usage.down,
|
||||
}));
|
||||
const t = useI18n("widget.systemResources.card");
|
||||
const { formatByteRate } = useByteFormatter();
|
||||
|
||||
const tooltipLabel = (index: number) => {
|
||||
const point = usageOverTime[index];
|
||||
return (
|
||||
<Stack gap={2}>
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Box
|
||||
bg="orange.5"
|
||||
w={8}
|
||||
h={8}
|
||||
style={{ borderRadius: 99, flexShrink: 0 }}
|
||||
/>
|
||||
<Box bg="orange.5" w={8} h={8} style={{ borderRadius: 99, flexShrink: 0 }} />
|
||||
<Text size="xs">
|
||||
{t("up")}: {formatByteRate(Math.round(point?.up ?? 0))}
|
||||
</Text>
|
||||
</Group>
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Box
|
||||
bg="yellow.5"
|
||||
w={8}
|
||||
h={8}
|
||||
style={{ borderRadius: 99, flexShrink: 0 }}
|
||||
/>
|
||||
<Box bg="yellow.5" w={8} h={8} style={{ borderRadius: 99, flexShrink: 0 }} />
|
||||
<Text size="xs">
|
||||
{t("down")}: {formatByteRate(Math.round(point?.down ?? 0))}
|
||||
</Text>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IconBrain } from "@tabler/icons-react";
|
||||
|
||||
import { formatBytesPair } from "@homarr/common";
|
||||
import { useByteFormatter } from "@homarr/settings";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { LabelDisplayModeOption } from "..";
|
||||
@@ -24,24 +24,21 @@ export const SystemResourceMemoryChart = ({
|
||||
usage,
|
||||
}));
|
||||
const t = useI18n("widget.systemResources.card");
|
||||
const { formatBytesPair } = useByteFormatter();
|
||||
|
||||
const percentageUsed =
|
||||
memoryUsageOverTime.length > 0 && totalCapacityInBytes > 0
|
||||
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
memoryUsageOverTime[memoryUsageOverTime.length - 1]! /
|
||||
totalCapacityInBytes
|
||||
memoryUsageOverTime[memoryUsageOverTime.length - 1]! / totalCapacityInBytes
|
||||
: undefined;
|
||||
|
||||
const tooltipLabel = (index: number) => {
|
||||
const used = memoryUsageOverTime[index] ?? 0;
|
||||
const memory = formatBytesPair(Math.round(used), totalCapacityInBytes);
|
||||
const percent =
|
||||
totalCapacityInBytes > 0
|
||||
? Math.round((used / totalCapacityInBytes) * 100)
|
||||
: 0;
|
||||
const percent = totalCapacityInBytes > 0 ? Math.round((used / totalCapacityInBytes) * 100) : 0;
|
||||
return t("memoryTooltip", {
|
||||
used: memory.used,
|
||||
available: memory.available,
|
||||
available: memory.total,
|
||||
percent,
|
||||
});
|
||||
};
|
||||
@@ -56,11 +53,7 @@ export const SystemResourceMemoryChart = ({
|
||||
labelDisplayMode={labelDisplayMode}
|
||||
advanced={advanced}
|
||||
yAxisProps={{ domain: [0, totalCapacityInBytes] }}
|
||||
lastValue={
|
||||
percentageUsed !== undefined
|
||||
? `${Math.round(percentageUsed * 100)}%`
|
||||
: undefined
|
||||
}
|
||||
lastValue={percentageUsed !== undefined ? `${Math.round(percentageUsed * 100)}%` : undefined}
|
||||
chartType={hasShadow ? "area" : "line"}
|
||||
tooltipLabel={tooltipLabel}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IconArrowDown, IconArrowUp } from "@tabler/icons-react";
|
||||
|
||||
import { formatByteRate } from "@homarr/common";
|
||||
import { useByteFormatter } from "@homarr/settings";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
|
||||
import type { LabelDisplayModeOption } from "..";
|
||||
@@ -21,6 +21,7 @@ export const NetworkTrafficChart = ({
|
||||
}) => {
|
||||
const chartData = usageOverTime.map((usage, index) => ({ index, usage }));
|
||||
const t = useI18n("widget.systemResources.card");
|
||||
const { formatByteRate } = useByteFormatter();
|
||||
|
||||
const max = Math.max(...usageOverTime);
|
||||
const upperBound = max + max * 0.2;
|
||||
@@ -38,9 +39,7 @@ export const NetworkTrafficChart = ({
|
||||
chartType={hasShadow ? "area" : "line"}
|
||||
labelDisplayMode={labelDisplayMode}
|
||||
advanced={advanced}
|
||||
tooltipLabel={(index) =>
|
||||
formatByteRate(Math.round(usageOverTime[index] ?? 0))
|
||||
}
|
||||
tooltipLabel={(index) => formatByteRate(Math.round(usageOverTime[index] ?? 0))}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user