import { useQuery } from "react-query"; import { APIClient } from "../../api/APIClient"; import { EmptySimple } from "../../components/emptystates"; import { useToggle } from "../../hooks/hooks"; import { NotificationAddForm, NotificationUpdateForm } from "../../forms/settings/NotificationForms"; import { Switch } from "@headlessui/react"; import { classNames } from "../../utils"; import { componentMapType } from "../../forms/settings/DownloadClientForms"; function NotificationSettings() { const [addNotificationsIsOpen, toggleAddNotifications] = useToggle(false); const { data } = useQuery( "notifications", () => APIClient.notifications.getAll(), { refetchOnWindowFocus: false } ); return (

Notifications

Send notifications on events.

{data && data.length > 0 ?
  1. Enabled
    Name
    Type
    Events
  2. {data && data.map((n: Notification) => ( ))}
: }
); } const DiscordIcon = () => ( ); const TelegramIcon = () => ( ); const iconComponentMap: componentMapType = { DISCORD: Discord, NOTIFIARR: Notifiarr, TELEGRAM: Telegram }; interface ListItemProps { notification: Notification; } function ListItem({ notification }: ListItemProps) { const [updateFormIsOpen, toggleUpdateForm] = useToggle(false); return (
  • Use setting
    {notification.name}
    {iconComponentMap[notification.type]}
    {notification.events.length}
    Edit
  • ); } export default NotificationSettings;