feat: Add bulk AI analyzer component to process product data and generate insights.

This commit is contained in:
Michael committed 2026-02-23 00:40:49 +01:00
1 parent 8c02771e46
commit 17498dcc10
4 files changed
+47 -8

No files matched your search

+19
View File
@@ -25,6 +25,7 @@ interface GridState {
setDisplayDensity: (density: "compact" | "normal" | "comfortable") => void;
setActiveGridQuery: (query: string) => void;
restoreSnapshot: (changes: Record<string, GammeCode>) => void;
batchSetDraftGamme: (changes: Record<string, GammeCode>) => void;
}
function computeSummary(rows: ProductRow[], drafts: Record<string, GammeCode>): GridSummary {
@@ -105,6 +106,24 @@ export const useGridStore = create<GridState>()(
restoreSnapshot: (changes) => {
set({ draftChanges: changes, summary: computeSummary(get().rows, changes) });
},
batchSetDraftGamme: (newChanges) => {
const { rows, draftChanges: oldDrafts } = get();
const updatedDrafts = { ...oldDrafts };
Object.entries(newChanges).forEach(([codein, gamme]) => {
const originalRow = rows.find(r => r.codein === codein);
const originalGamme = originalRow?.codeGamme;
if (gamme === originalGamme) {
delete updatedDrafts[codein];
} else {
updatedDrafts[codein] = gamme;
}
});
set({ draftChanges: updatedDrafts, summary: computeSummary(rows, updatedDrafts) });
},
}),
{
name: "collectflow-grid-storage",