Added the sonner library for toast notifications across various components, improving user feedback for actions such as saving settings, syncing rules, and handling errors. Updated the layout to include a Toaster component for consistent notification display. Refactored alert messages in the backups, gre, and filters pages to utilize the new notification system, enhancing overall user experience.
28 lines
855 B
TypeScript
28 lines
855 B
TypeScript
"use client"
|
|
|
|
import { useTheme } from "next-themes"
|
|
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
|
|
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
const { resolvedTheme } = useTheme()
|
|
|
|
return (
|
|
<Sonner
|
|
theme={(resolvedTheme as ToasterProps["theme"]) ?? "system"}
|
|
className="toaster group"
|
|
richColors
|
|
toastOptions={{
|
|
classNames: {
|
|
toast: "group toast group-[.toaster]:border-border group-[.toaster]:bg-card group-[.toaster]:text-card-foreground group-[.toaster]:shadow-lg",
|
|
description: "group-[.toast]:text-muted-foreground",
|
|
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
},
|
|
}}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Toaster }
|