import { useTranslation } from "react-i18next"; import { formatDistanceKm } from "~/lib/stats"; export interface WeeklyDistanceBucket { weekStart: string; distance: number; } /** * Compact weekly-distance bar chart for the profile (last N weeks, oldest → * newest). Bars are normalized to the busiest week; empty weeks keep their slot * as a zero-height bar so the axis stays contiguous. Renders nothing when there * is no distance in the window. */ export function WeeklyDistanceChart({ weeks, className, }: { weeks: WeeklyDistanceBucket[]; className?: string; }) { const { t } = useTranslation("journal"); const max = weeks.reduce((m, w) => Math.max(m, w.distance), 0); if (max <= 0) return null; return (
{t("profileStats.weeklyDistance")}