From f15fbe69ecba87e96921961c4948cb7a13734a54 Mon Sep 17 00:00:00 2001 From: R0m1k3 Date: Tue, 10 Mar 2026 12:56:37 +0100 Subject: [PATCH] feat: Implement core grid state management with Zustand, define grid data types, and introduce a heatmap cell component. --- src/features/grid/components/floating-summary-bar.tsx | 4 ++++ src/features/grid/components/heatmap-cell.tsx | 2 +- src/features/grid/store/use-grid-store.ts | 2 ++ src/types/grid.ts | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/features/grid/components/floating-summary-bar.tsx b/src/features/grid/components/floating-summary-bar.tsx index 7f201b0..010b689 100644 --- a/src/features/grid/components/floating-summary-bar.tsx +++ b/src/features/grid/components/floating-summary-bar.tsx @@ -145,6 +145,10 @@ export function FloatingSummaryBar() {
+ { const heatClass = getHeatmapClass(value); - const display = value === null || value === 0 ? "—" : Math.round(Math.abs(value)).toString(); + const display = value === null || value === 0 ? "0" : Math.round(Math.abs(value)).toString(); return (
): const totalCa = active.reduce((s, r) => s + (r.totalCa ?? 0), 0); const totalMarge = active.reduce((s, r) => s + (r.totalMarge ?? 0), 0); return { + totalProducts: rows.length, totalRows: active.length, totalQuantite: active.reduce((s, r) => s + (r.totalQuantite ?? 0), 0), totalCa, @@ -65,6 +66,7 @@ export const useGridStore = create()( search: "", }, summary: { + totalProducts: 0, totalRows: 0, totalQuantite: 0, totalCa: 0, diff --git a/src/types/grid.ts b/src/types/grid.ts index 7487355..294d8b9 100644 --- a/src/types/grid.ts +++ b/src/types/grid.ts @@ -70,6 +70,7 @@ export interface ProductRow { /** Summary bar totals for the currently visible/filtered rows */ export interface GridSummary { + totalProducts: number; totalRows: number; totalQuantite: number; totalCa: number;