import { useEffect } from "react"; /** * A short-lived confirmation with an undo. * * Ignoring an event makes it vanish, which is exactly what was asked for and * also the moment a mistake is least recoverable — the row you would click to * undo is the row that just disappeared. The undo lives here instead. */ export function Toast({ message, actionLabel, onAction, onDismiss, ms = 7000, }: { message: string; actionLabel: string; onAction: () => void; onDismiss: () => void; ms?: number; }) { useEffect(() => { const id = setTimeout(onDismiss, ms); return () => clearTimeout(id); }, [onDismiss, ms, message]); return (
{message}