"use client"; import { useGridStore } from "@/features/grid/store/use-grid-store"; import { GammeCode } from "@/types/grid"; import { cn } from "@/lib/utils"; 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: "Z — Sortie", code: "Z", color: "border-rose-600 text-rose-400 hover:bg-rose-900/20" }, ]; interface BulkActionToolbarProps { selectedCodeins: string[]; onClearSelection: () => void; } export function BulkActionToolbar({ selectedCodeins, onClearSelection }: BulkActionToolbarProps) { const { batchSetDraftGamme } = useGridStore(); if (selectedCodeins.length === 0) return null; const applyBulk = (code: GammeCode) => { const changes = selectedCodeins.reduce((acc, codein) => { acc[codein] = code; return acc; }, {} as Record); batchSetDraftGamme(changes); onClearSelection(); }; return (
{selectedCodeins.length} sélectionné{selectedCodeins.length > 1 ? "s" : ""}
Appliquer en masse : {GAMME_OPTIONS.map(({ label, code, color }) => ( ))}
); }