import { toast as sonnerToast } from 'sonner'; // Define the options type based on the sonner toast parameter type ToastOptions = Parameters[1]; // Create a function to get the current theme-specific styles at runtime const getThemeStyles = () => { const isDark = document.documentElement.classList.contains('dark'); return { backgroundColor: isDark ? 'rgb(26, 27, 30)' : 'rgb(255, 255, 255)', color: isDark ? 'rgb(255, 255, 255)' : 'rgb(0, 0, 0)', border: `1px solid ${isDark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)'}`, boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)', opacity: 1, }; }; // Create a wrapper for the toast functions to apply consistent styling export const toast = { success: (message: string, options?: ToastOptions) => { return sonnerToast.success(message, { position: 'bottom-right', duration: 5000, closeButton: true, style: getThemeStyles(), ...options }); }, error: (message: string, options?: ToastOptions) => { return sonnerToast.error(message, { position: 'bottom-right', duration: 5000, closeButton: true, style: getThemeStyles(), ...options }); }, info: (message: string, options?: ToastOptions) => { return sonnerToast.info(message, { position: 'bottom-right', duration: 5000, closeButton: true, style: getThemeStyles(), ...options }); }, warning: (message: string, options?: ToastOptions) => { return sonnerToast.warning(message, { position: 'bottom-right', duration: 5000, closeButton: true, style: getThemeStyles(), ...options }); }, // Note: custom and promise implementations are removed due to TypeScript errors // Add these back if needed with proper typing dismiss: (toastId?: string) => { return sonnerToast.dismiss(toastId); }, }; export default toast;