import { toast as sonnerToast } from "sonner"; /** * Toast notification utility wrapper around Sonner * * Provides a consistent API for showing toast notifications throughout the app */ export const toast = { /** * Show a success toast notification * @param message - The message to display * @param description - Optional description text */ success: (message: string, description?: string) => { return sonnerToast.success(message, { description }); }, /** * Show an error toast notification * @param message - The message to display * @param description - Optional description text */ error: (message: string, description?: string) => { return sonnerToast.error(message, { description }); }, /** * Show an info toast notification * @param message - The message to display * @param description - Optional description text */ info: (message: string, description?: string) => { return sonnerToast.info(message, { description }); }, /** * Show a warning toast notification * @param message - The message to display * @param description - Optional description text */ warning: (message: string, description?: string) => { return sonnerToast.warning(message, { description }); }, /** * Show a loading toast notification * @param message - The message to display * @returns Toast ID that can be used to update or dismiss the toast */ loading: (message: string) => { return sonnerToast.loading(message); }, /** * Show a promise toast that updates based on promise state * @param promise - The promise to track * @param messages - Messages for loading, success, and error states */ promise: ( promise: Promise, messages: { loading: string; success: string | ((data: T) => string); error: string | ((error: Error) => string); }, ) => { return sonnerToast.promise(promise, messages); }, /** * Dismiss a specific toast by ID or all toasts * @param toastId - Optional toast ID to dismiss. If not provided, dismisses all toasts */ dismiss: (toastId?: string | number) => { return sonnerToast.dismiss(toastId); }, };