diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index 434493b..44af3fc 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -5,6 +5,9 @@ ### Ajouté - **Rapport Cartes** : info-bulle d'aide sur le KPI taux d'épargne expliquant la formule — `(revenus − dépenses) ÷ revenus × 100`, calculée sur le mois de référence (#101) +### Modifié +- **Rapport Zoom catégorie** (`/reports/category`) : le sélecteur de catégorie est désormais un combobox saisissable et filtrable avec recherche insensible aux accents, navigation clavier (↑/↓/Entrée/Échap) et indentation hiérarchique, en remplacement du `` (#103) + ### Fixed - **Cartes report**: removed the non-functional period selector — the Cartes report is a "month X vs X-1 vs X-12" snapshot, so only the reference-month picker is needed (#101) - **Cartes report**: savings-rate KPI now shows "—" instead of "0 %" when the reference month has no income (division by zero is undefined, not zero) (#101) diff --git a/src/components/reports/CategoryZoomHeader.tsx b/src/components/reports/CategoryZoomHeader.tsx index 78bdc3d..84c0391 100644 --- a/src/components/reports/CategoryZoomHeader.tsx +++ b/src/components/reports/CategoryZoomHeader.tsx @@ -1,13 +1,8 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { getAllCategoriesWithCounts } from "../../services/categoryService"; - -interface CategoryOption { - id: number; - name: string; - color: string | null; - parent_id: number | null; -} +import CategoryCombobox from "../shared/CategoryCombobox"; +import type { Category } from "../../shared/types"; export interface CategoryZoomHeaderProps { categoryId: number | null; @@ -23,13 +18,24 @@ export default function CategoryZoomHeader({ onIncludeSubcategoriesChange, }: CategoryZoomHeaderProps) { const { t } = useTranslation(); - const [categories, setCategories] = useState([]); + const [categories, setCategories] = useState([]); useEffect(() => { getAllCategoriesWithCounts() .then((rows) => setCategories( - rows.map((r) => ({ id: r.id, name: r.name, color: r.color, parent_id: r.parent_id })), + rows.map((r) => ({ + id: r.id, + name: r.name, + parent_id: r.parent_id ?? undefined, + color: r.color ?? undefined, + icon: r.icon ?? undefined, + type: r.type, + is_active: r.is_active, + is_inputable: r.is_inputable, + sort_order: r.sort_order, + created_at: "", + })), ), ) .catch(() => setCategories([])); @@ -41,18 +47,13 @@ export default function CategoryZoomHeader({ {t("reports.category.selectCategory")} - +