fix(widgets): replace system-resources chart tooltip with Mantine (#6729)
* fix(widgets): replace system-resources chart tooltip with Mantine Tooltip.Floating
This commit is contained in:
1 parent
5f572f1b92
commit
c18fa8cf77
7 files changed
+238
-170
No files matched your search
@@ -1,4 +1,3 @@
|
||||
import { Paper, Text } from "@mantine/core";
|
||||
import { IconDeviceDesktop } from "@tabler/icons-react";
|
||||
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
@@ -27,25 +26,16 @@ export const SystemResourceGPUChart = ({
|
||||
title={invariantTechnicalLabels.gpu}
|
||||
icon={IconDeviceDesktop}
|
||||
lastValue={
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
gpuUsageOverTime.length > 0 ? `${Math.round(gpuUsageOverTime[gpuUsageOverTime.length - 1]!)}%` : undefined
|
||||
gpuUsageOverTime.length > 0
|
||||
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
`${Math.round(gpuUsageOverTime[gpuUsageOverTime.length - 1]!)}%`
|
||||
: undefined
|
||||
}
|
||||
chartType={hasShadow ? "area" : "line"}
|
||||
yAxisProps={{ domain: [0, 100] }}
|
||||
labelDisplayMode={labelDisplayMode}
|
||||
advanced={advanced}
|
||||
tooltipProps={{
|
||||
content: ({ payload }) => {
|
||||
const value = payload[0] ? Number(payload[0].value) : 0;
|
||||
return (
|
||||
<Paper px={3} py={2} shadow="md">
|
||||
<Text c="dimmed" size="xs">
|
||||
{value.toFixed(0)}%
|
||||
</Text>
|
||||
</Paper>
|
||||
);
|
||||
},
|
||||
}}
|
||||
tooltipLabel={(index) => `${Math.round(gpuUsageOverTime[index] ?? 0)}%`}
|
||||
/>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user