import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { TrendingUp, TrendingDown } from "lucide-react"; import type { CartesTopMover } from "../../../shared/types"; export interface TopMoversListProps { movers: CartesTopMover[]; direction: "up" | "down"; } function formatSignedCurrency(amount: number, language: string): string { return new Intl.NumberFormat(language === "fr" ? "fr-CA" : "en-CA", { style: "currency", currency: "CAD", maximumFractionDigits: 0, signDisplay: "always", }).format(amount); } function formatPct(pct: number | null, language: string): string { if (pct === null) return "—"; return new Intl.NumberFormat(language === "fr" ? "fr-CA" : "en-CA", { style: "percent", maximumFractionDigits: 1, signDisplay: "always", }).format(pct / 100); } function categoryHref(categoryId: number | null): string { if (categoryId === null) return "/transactions"; const params = new URLSearchParams(window.location.search); params.set("cat", String(categoryId)); return `/reports/category?${params.toString()}`; } export default function TopMoversList({ movers, direction }: TopMoversListProps) { const { t, i18n } = useTranslation(); const title = direction === "up" ? t("reports.cartes.topMoversUp") : t("reports.cartes.topMoversDown"); const Icon = direction === "up" ? TrendingUp : TrendingDown; const accentClass = direction === "up" ? "text-[var(--negative)]" : "text-[var(--positive)]"; return (