import React, { useEffect, useState } from 'react'; import { Undo2, X, AlertCircle } from 'lucide-react'; import { cn } from '../lib/utils'; import { ExcelRow } from '../types'; interface UndoToastProps { undoState: { data: ExcelRow[], message: string } | null; onUndo: () => void; onClose: () => void; } export function UndoToast({ undoState, onUndo, onClose }: UndoToastProps) { const [isVisible, setIsVisible] = useState(false); useEffect(() => { if (undoState) { setIsVisible(true); const timer = setTimeout(() => { setIsVisible(false); setTimeout(onClose, 300); // Wait for transition }, 8000); return () => clearTimeout(timer); } else { setIsVisible(false); } }, [undoState, onClose]); if (!undoState && !isVisible) return null; return (