"use client"; import { useMemo } from "react"; import StorageDonut from "@/components/dashboard/StorageDonut"; import { aggregateByCategory, type CategoryStat } from "@/components/dashboard/categories"; import { STORAGE_QUOTA_BYTES } from "@/lib/prefs"; interface TypeBreakdown { type: string; count: number; size: number; } interface StorageChartProps { data: TypeBreakdown[]; totalSize: number; /** Si fourni par l'API (v3), utilisé tel quel ; sinon agrégé côté client. */ byCategory?: CategoryStat[]; } /** Répartition du stockage par catégorie — même donut que l'accueil. */ export default function StorageChart({ data, totalSize, byCategory }: StorageChartProps) { const cats = useMemo(() => byCategory && byCategory.length ? byCategory : aggregateByCategory(data), [byCategory, data]); return ; }