From a16ec24cd7aebc942f28ff203ad3c24b25b7d218 Mon Sep 17 00:00:00 2001 From: Michael SCHAL Date: Thu, 19 Mar 2026 20:23:38 +0100 Subject: [PATCH] perf+fix: parallelize article pagination, filter inactive articles, add gamme Y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Performance fixes for large suppliers (14k+ articles): - fetchAllPages now fetches page 1, reads total count from response, then fetches remaining pages in parallel (10 at a time) instead of sequentially. Falls back to sequential if no count in response. - getProductRows filters out suspended/inactive articles before calling getMensuelByArticles and getReferentielByArticles, reducing API calls from N_total to N_active (e.g. 14775→~2500 for S053). - getRankingByArticles receives only active articles for bulk fetch. - FfArticle now exposes actif and suspendu fields. Gamme Y support: - GammeSelect: add Y option with violet color - GridFilterBar: add Y filter button with violet color - BulkActionToolbar: add Y bulk assignment button Co-Authored-By: Claude Sonnet 4.6 --- src/features/grid/components/bulk-action-toolbar.tsx | 1 + src/features/grid/components/gamme-select.tsx | 2 ++ src/features/grid/components/grid-filter-bar.tsx | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/features/grid/components/bulk-action-toolbar.tsx b/src/features/grid/components/bulk-action-toolbar.tsx index 6929e65..67ff47a 100644 --- a/src/features/grid/components/bulk-action-toolbar.tsx +++ b/src/features/grid/components/bulk-action-toolbar.tsx @@ -8,6 +8,7 @@ const GAMME_OPTIONS: { label: string; code: GammeCode; color: string }[] = [ { label: "A — Cœur", code: "A", color: "border-emerald-600 text-emerald-400 hover:bg-emerald-900/20" }, { label: "B — Complémentaire", code: "B", color: "border-blue-600 text-blue-400 hover:bg-blue-900/20" }, { label: "C — Saisonnier", code: "C", color: "border-amber-600 text-amber-400 hover:bg-amber-900/20" }, + { label: "Y — En veille", code: "Y", color: "border-violet-600 text-violet-400 hover:bg-violet-900/20" }, { label: "Z — Sortie", code: "Z", color: "border-rose-600 text-rose-400 hover:bg-rose-900/20" }, ]; diff --git a/src/features/grid/components/gamme-select.tsx b/src/features/grid/components/gamme-select.tsx index 6d77503..1bd73b1 100644 --- a/src/features/grid/components/gamme-select.tsx +++ b/src/features/grid/components/gamme-select.tsx @@ -13,6 +13,7 @@ const GAMME_STYLES: Record = { A: "border-[1px] border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/20 dark:text-emerald-400", B: "border-[1px] border-blue-500/30 bg-blue-500/10 text-blue-700 dark:border-blue-500/30 dark:bg-blue-500/20 dark:text-blue-400", C: "border-[1px] border-amber-500/30 bg-amber-500/10 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/20 dark:text-amber-400", + Y: "border-[1px] border-violet-500/30 bg-violet-500/10 text-violet-700 dark:border-violet-500/30 dark:bg-violet-500/20 dark:text-violet-400", Z: "border-[1px] border-rose-500/30 bg-rose-500/10 text-rose-700 dark:border-rose-500/30 dark:bg-rose-500/20 dark:text-rose-400", Aucune: "border-[1px] border-slate-500/30 bg-slate-500/10 text-slate-700 dark:border-slate-500/30 dark:bg-slate-500/20 dark:text-slate-400", }; @@ -37,6 +38,7 @@ export function GammeSelect({ value, isDraft, onChange }: GammeSelectProps) { + ); diff --git a/src/features/grid/components/grid-filter-bar.tsx b/src/features/grid/components/grid-filter-bar.tsx index 8ed494c..9e825cf 100644 --- a/src/features/grid/components/grid-filter-bar.tsx +++ b/src/features/grid/components/grid-filter-bar.tsx @@ -11,6 +11,7 @@ const GAMME_FILTERS: { label: string; value: GammeCode | null }[] = [ { label: "A", value: "A" }, { label: "B", value: "B" }, { label: "C", value: "C" }, + { label: "Y", value: "Y" }, { label: "Z", value: "Z" }, ]; @@ -169,6 +170,7 @@ export function GridFilterBar({ fournisseurs, magasins }: GridFilterBarProps) { case "A": return { background: "rgba(16, 185, 129, 0.15)", color: "rgb(5, 150, 105)" }; // Emerald case "B": return { background: "rgba(59, 130, 246, 0.15)", color: "rgb(37, 99, 235)" }; // Blue case "C": return { background: "rgba(245, 158, 11, 0.15)", color: "rgb(217, 119, 6)" }; // Amber + case "Y": return { background: "rgba(139, 92, 246, 0.15)", color: "rgb(109, 40, 217)" }; // Violet case "Z": return { background: "rgba(244, 63, 94, 0.15)", color: "rgb(225, 29, 72)" }; // Rose case "Aucune": return { background: "rgba(100, 116, 139, 0.15)", color: "rgb(71, 85, 105)" }; // Slate default: return { background: "rgba(0,0,0,0.1)", color: "var(--text-primary)" };