"use client" import { useState } from "react" import AddNotification from "@/components/dialogues/AddNotification" import DeleteNotification from "@/components/dialogues/DeleteNotification" import TestNotification from "@/components/dialogues/TestNotification" import useNotifications from "@/hooks/useNotifications" import { Plus, Trash2, Play, Bell, Settings, CheckCircle, AlertCircle } from "lucide-react" import Loading from "@/components/Loading" export const NotificationProviderSettings = ({ onError, onSuccess, }: { onError: (message: string) => void; onSuccess: (message: string) => void }) => { const { loadNotifications, notifications, loading, testNotification } = useNotifications() const [deleteNotificationId, setDeleteNotificationId] = useState(null) const [notificationTestId, setNotificationTestId] = useState(null) const testNotificationHandler = async (notificationProviderId: number) => { ;(document.getElementById("test_notification") as HTMLDialogElement)?.showModal() const notificationTest = await testNotification(notificationProviderId) setNotificationTestId(notificationTest) } const getTypeIcon = (type: string) => { switch (type.toLowerCase()) { case "email": return "📧" case "slack": return "💬" case "discord": return "🎮" case "webhook": return "🔗" case "telegram": return "✈️" default: return "🔔" } } const getTypeBadgeColor = (type: string) => { switch (type.toLowerCase()) { case "email": return "badge-primary" case "slack": return "badge-secondary" case "discord": return "badge-accent" case "webhook": return "badge-info" case "telegram": return "badge-success" default: return "badge-neutral" } } return (
{/* Header */}

Notification Providers

Manage your notification providers and test connections

{/* Content */} {loading ? (
) : notifications && notifications.length > 0 ? (
{/* Table Content */}
{notifications.map((notification: any, index: number) => ( ))}
ID Provider Type Status Actions
{notification.id}
{getTypeIcon(notification.type)}
{notification.name}
Provider #{notification.id}
{notification.type}
Active
) : (

No Providers Configured

Get started by adding your first notification provider. You can configure SMTP, Ntfy, Telegram and more.

)} {/* Dialogs */} {deleteNotificationId && ( )} {notificationTestId && }
) }