import toast from 'react-hot-toast'; export const showToast = { success: (message: string) => toast.success(message), error: (message: string) => toast.error(message), loading: (message: string) => toast.loading(message), dismiss: (toastId: string) => toast.dismiss(toastId), promise: ( promise: Promise, messages: { loading: string; success: string; error: string } ) => toast.promise(promise, messages), /** * Show a confirmation toast with an Undo button. The toast stays * visible for `ms` (default 5000) and the user can click Undo to * fire `onUndo`. If the user does nothing, the toast just dismisses. */ undo: (message: string, onUndo: () => void, ms = 5000) => { return toast( (t) => ( {message} ), { duration: ms, icon: '\u2715', style: { background: '#fff', color: '#404040' }, } ); }, };