Implement Undo system for AI and bulk actions

This commit is contained in:
Christian Vidal Wolf
2026-03-29 17:35:07 +02:00
parent 3db2bc0dae
commit e498325975
5 changed files with 105 additions and 2 deletions
+6 -1
View File
@@ -9,9 +9,10 @@ interface EditPanelProps {
rowIndex: number;
onSave: (rowIndex: number, updatedRow: ExcelRow) => void;
onClose: () => void;
onCaptureState: (message: string) => void;
}
export function EditPanel({ row, rowIndex, onSave, onClose }: EditPanelProps) {
export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: EditPanelProps) {
const [formData, setFormData] = useState({
longDe: row[COLUMNS.LONG_DE] || '',
longEn: row[COLUMNS.LONG_EN] || '',
@@ -100,6 +101,10 @@ export function EditPanel({ row, rowIndex, onSave, onClose }: EditPanelProps) {
};
const handleSave = () => {
const hasModifications = Object.keys(formData).some(k => isModified(k as keyof typeof formData));
if (hasModifications) {
onCaptureState(`Updated product ${row[COLUMNS.ARTICLE_NO]}`);
}
const newRow = [...row];
newRow[COLUMNS.LONG_DE] = formData.longDe;
newRow[COLUMNS.LONG_EN] = formData.longEn;