"use client"; import { Group, SimpleGrid, Stack, Text } from "@mantine/core"; import { IconArrowDown, IconArrowUp, IconCircleCheck, IconCircleX, IconWaveSine } from "@tabler/icons-react"; import type { SpeedtestTrackerResult } from "@homarr/integrations/types"; import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client"; import { formatResultSpeed } from "./helpers"; import { SectionLabel } from "./section-label"; import { SpeedStatCard } from "./speed-stat-card"; export function LatestResultSection({ result, width = 500, compactSurface = false, }: { result: SpeedtestTrackerResult; width?: number; compactSurface?: boolean; }) { const t = useI18n("widget.speedtestTracker"); const locale = useCurrentIntlLocale(); const timestamp = Intl.DateTimeFormat(locale, { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", }).format(result.created_at); const metricCount = result.healthy !== null ? 4 : 3; const cols = width < 230 ? 2 : metricCount; return ( {t("latestResult")} {timestamp} {result.healthy !== null && ( )} ); }