mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 12:55:23 +02:00
feat: add undo button in DimensionsView for pending changes
This commit is contained in:
@@ -414,6 +414,7 @@ export default function App() {
|
||||
onSaveRow={handleSaveRow}
|
||||
onCaptureState={captureState}
|
||||
rowStatuses={rowStatuses}
|
||||
onRevertRow={handleRevertRow}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { ExcelRow, COLUMNS } from '../types';
|
||||
import { AlertTriangle, CheckCircle2, ChevronDown, ChevronRight, Edit2, Package, Boxes, Scale, Loader2, RefreshCw, Layers, Link2, Search, Filter, X as XIcon } from 'lucide-react';
|
||||
import { AlertTriangle, CheckCircle2, ChevronDown, ChevronRight, Edit2, Package, Boxes, Scale, Loader2, RefreshCw, Layers, Link2, Search, Filter, X as XIcon, Undo2 } from 'lucide-react';
|
||||
import { cn } from '../lib/utils';
|
||||
import { ConfirmModal } from './ConfirmModal';
|
||||
import { ColumnFilterPopover } from './ColumnFilterPopover';
|
||||
@@ -12,6 +12,7 @@ interface DimensionsViewProps {
|
||||
onSaveRow: (index: number, updatedRow: ExcelRow) => void;
|
||||
onCaptureState: (message: string) => void;
|
||||
rowStatuses: Record<string, string>;
|
||||
onRevertRow: (articleNo: string) => void;
|
||||
}
|
||||
|
||||
interface DimensionGroup {
|
||||
@@ -33,7 +34,7 @@ interface NearDuplicateCluster {
|
||||
maxDiffPct: number;
|
||||
}
|
||||
|
||||
export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureState, rowStatuses }: DimensionsViewProps) {
|
||||
export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureState, rowStatuses, onRevertRow }: DimensionsViewProps) {
|
||||
const [expandedGroups, setExpandedGroups] = useState<Set<string>>(new Set());
|
||||
const [expandedNearDuplicates, setExpandedNearDuplicates] = useState<Set<number>>(new Set());
|
||||
const [showOnlyInconsistent, setShowOnlyInconsistent] = useState(true);
|
||||
@@ -672,6 +673,15 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat
|
||||
>
|
||||
{syncing?.key === group.key && syncing?.field === 'all' ? <Loader2 className="w-4 h-4 animate-spin" /> : <RefreshCw className="w-4 h-4" />}
|
||||
</button>
|
||||
{isPending && (
|
||||
<button
|
||||
onClick={() => onRevertRow(String(row[COLUMNS.ARTICLE_NO]))}
|
||||
title="Undo pending changes"
|
||||
className="p-1.5 hover:bg-red-600/20 text-slate-500 hover:text-red-400 rounded transition-all"
|
||||
>
|
||||
<Undo2 className="w-4 h-4" />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
onClick={() => onEdit(index)}
|
||||
title="Edit product"
|
||||
|
||||
Reference in New Issue
Block a user