"use client"
import type React from "react"
import { BadgeCheck, Loader2, ShieldAlert, TriangleAlert } from "lucide-react"
import { Toaster as Sonner, toast as sonnerToast, type ExternalToast } from "sonner"
type NotifyOptions = Pick<
ExternalToast,
| "duration"
| "id"
| "action"
| "cancel"
| "onDismiss"
| "onAutoClose"
| "className"
>
function toastOptions(
description?: string,
options?: NotifyOptions
): ExternalToast | undefined {
const merged: ExternalToast = { ...options }
if (description) merged.description = description
return Object.keys(merged).length > 0 ? merged : undefined
}
/** Blue circle for neutral / informational toasts (matches web `servers/nextjs` Toaster). */
function NeutralToastIcon() {
return (
)
}
/** Standard toast API — title plus optional description (matches styled [data-title] / [data-description]). */
export const notify = {
error: (title: string, description?: string, options?: NotifyOptions) =>
sonnerToast.error(title, toastOptions(description, options)),
success: (title: string, description?: string, options?: NotifyOptions) =>
sonnerToast.success(title, toastOptions(description, options)),
info: (title: string, description?: string, options?: NotifyOptions) =>
sonnerToast.info(title, toastOptions(description, options)),
warning: (title: string, description?: string, options?: NotifyOptions) =>
sonnerToast.warning(title, toastOptions(description, options)),
loading: (title: string, description?: string, options?: NotifyOptions) =>
sonnerToast.loading(title, toastOptions(description, options)),
dismiss: (id?: string | number) => sonnerToast.dismiss(id),
} as const
type ToasterProps = React.ComponentProps
const Toaster = ({ icons, ...props }: ToasterProps) => {
const defaultIcons: NonNullable = {
success: ,
error: ,
info: ,
warning: ,
loading: ,
close: Got it!,
}
return (
<>
>
)
}
export { Toaster }