diff --git a/src/App.tsx b/src/App.tsx index ca2de95..b9ff5f9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -558,6 +558,7 @@ export default function App() { headers={appState.headers} data={appState.data} sessionToken={session?.access_token} + onEdit={(index) => setEditingRowIndex(index)} onRevert={async (articleNo, revertedData, historyId) => { // Find the row in appState.data and update it const rowIndex = appState.data.findIndex(r => String(r[COLUMNS.ARTICLE_NO]) === articleNo); diff --git a/src/components/HistoryView.tsx b/src/components/HistoryView.tsx index aa70631..cd2dff7 100644 --- a/src/components/HistoryView.tsx +++ b/src/components/HistoryView.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { History, RotateCcw, ChevronDown, ChevronRight, User, Calendar, Tag, Search, X } from 'lucide-react'; +import { History, RotateCcw, ChevronDown, ChevronRight, User, Calendar, Tag, Search, X, Edit2 } from 'lucide-react'; import { getHistory, deleteHistoryEntry, HistoryEntry } from '../lib/supabase'; import { ExcelRow, COLUMNS } from '../types'; import { cn } from '../lib/utils'; @@ -8,10 +8,11 @@ interface HistoryViewProps { headers: string[]; data: ExcelRow[]; onRevert: (articleNo: string, oldData: ExcelRow, historyId?: number) => void; + onEdit?: (rowIndex: number) => void; sessionToken?: string; } -export function HistoryView({ headers, data, onRevert, sessionToken }: HistoryViewProps) { +export function HistoryView({ headers, data, onRevert, onEdit, sessionToken }: HistoryViewProps) { const [history, setHistory] = useState([]); const [loading, setLoading] = useState(true); const [expandedId, setExpandedId] = useState(null); @@ -175,6 +176,19 @@ export function HistoryView({ headers, data, onRevert, sessionToken }: HistoryVi {changes.length} {changes.length === 1 ? 'change' : 'changes'} +