import type { MantineColor, RingProgressProps } from "@mantine/core"; import { Card, Center, Group, RingProgress, ScrollArea, Stack, Text, Title, Tooltip } from "@mantine/core"; import { IconDatabaseHeart, IconFileDescription, IconHeartbeat, IconTransform } from "@tabler/icons-react"; import { useRequiredBoard } from "@homarr/boards/context"; import { humanFileSize } from "@homarr/common"; import type { TdarrPieSegment, TdarrStatistics } from "@homarr/integrations"; import { useI18n } from "@homarr/translation/client"; import type { TablerIcon } from "@homarr/ui"; const PIE_COLORS: MantineColor[] = ["cyan", "grape", "gray", "orange", "pink"]; interface StatisticsPanelProps { statistics: TdarrStatistics; } export function StatisticsPanel(props: StatisticsPanelProps) { const t = useI18n("widget.mediaTranscoding.panel.statistics"); const allLibs = props.statistics; // Check if Tdarr hs any Files if (!(allLibs.totalFileCount > 0)) { return (
{t("empty")}
); } return ( ); } interface StatisticRingProgressProps { items: TdarrPieSegment[]; label: string; } const StatisticRingProgress = ({ items, label }: StatisticRingProgressProps) => { return ( {label} ); }; function toRingProgressSections(segments: TdarrPieSegment[]): RingProgressProps["sections"] { const total = segments.reduce((prev, curr) => prev + curr.value, 0); return segments.map((segment, index) => ({ value: (segment.value * 100) / total, tooltip: `${segment.name}: ${segment.value}`, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion color: PIE_COLORS[index % PIE_COLORS.length]!, // Ensures a valid color in the case that index > PIE_COLORS.length })); } interface StatisticItemProps { icon: TablerIcon; value: string | number; label: string; } function StatisticItem(props: StatisticItemProps) { const board = useRequiredBoard(); return ( {props.value} ); }