import type { ReactNode } from 'react' import { toast } from '@heroui/react' type LegacyToastColor = 'default' | 'success' | 'warning' | 'danger' export interface AddToastOptions { title: ReactNode description?: ReactNode color?: LegacyToastColor timeout?: number onClose?: () => void } /** * Compatibility adapter for the HeroUI v2 `addToast` API. * * Keeping application call sites behind this module decouples business logic * from HeroUI's queue API and makes future notification-library changes local. */ export function addToast({ title, description, color = 'default', timeout, onClose }: AddToastOptions): string { const options = { description, timeout, onClose } switch (color) { case 'success': return toast.success(title, options) case 'warning': return toast.warning(title, options) case 'danger': return toast.danger(title, options) default: return toast(title, options) } }