import { memo, useState } from "react" import { useStore } from "@nanostores/react" import { $alerts, $systems } from "@/lib/stores" import { Dialog, DialogTrigger, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { BellIcon, GlobeIcon, ServerIcon } from "lucide-react" import { alertInfo, cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { AlertRecord, SystemRecord } from "@/types" import { Link } from "../router" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Checkbox } from "../ui/checkbox" import { SystemAlert, SystemAlertGlobal } from "./alerts-system" import { Trans, t } from "@lingui/macro" export default memo(function AlertsButton({ system }: { system: SystemRecord }) { const alerts = useStore($alerts) const [opened, setOpened] = useState(false) const systemAlerts = alerts.filter((alert) => alert.system === system.id) as AlertRecord[] const active = systemAlerts.length > 0 return ( {opened && } ) }) function TheContent({ data: { system, alerts, systemAlerts }, }: { data: { system: SystemRecord; alerts: AlertRecord[]; systemAlerts: AlertRecord[] } }) { const [overwriteExisting, setOverwriteExisting] = useState(false) const systems = $systems.get() const data = Object.keys(alertInfo).map((key) => { const alert = alertInfo[key as keyof typeof alertInfo] return { key: key as keyof typeof alertInfo, alert, system, } }) return ( <> Alerts See{" "} notification settings {" "} to configure how you receive alerts. {system.name} All Systems
{data.map((d) => ( ))}
{data.map((d) => ( ))}
) }