diff --git a/app/dashboard/settings/Settings.tsx b/app/dashboard/settings/Settings.tsx index 3d37a72..91a88c9 100644 --- a/app/dashboard/settings/Settings.tsx +++ b/app/dashboard/settings/Settings.tsx @@ -62,6 +62,7 @@ export default function Settings() { const [emailSuccess, setEmailSuccess] = useState(false) const [notificationType, setNotificationType] = useState("") + const [notificationName, setNotificationName] = useState("") const [smtpHost, setSmtpHost] = useState("") const [smtpPort, setSmtpPort] = useState(0) const [smtpSecure, setSmtpSecure] = useState(false) @@ -168,6 +169,7 @@ export default function Settings() { const addNotification = async () => { try { const response = await axios.post("/api/notifications/add", { + name: notificationName, type: notificationType, smtpHost: smtpHost, smtpPort: smtpPort, @@ -450,212 +452,220 @@ export default function Settings() { Add Notification - setSmtpHost(e.target.value)} - /> - -
- - setSmtpPort(Number(e.target.value))} - /> -
- - -
- setSmtpSecure(checked)} /> - -
- -
-
- - setSmtpUsername(e.target.value)} - /> -
- -
- - setSmtpPassword(e.target.value)} - /> -
+
+ setNotificationName(e.target.value)} + /> + setSmtpFrom(e.target.value)} + type="text" + id="smtpHost" + placeholder="smtp.example.com" + onChange={(e) => setSmtpHost(e.target.value)} + /> +
+
+ + setSmtpPort(Number(e.target.value))} + /> +
+
+ +
+ setSmtpSecure(checked)} /> + +
+ +
+
+ + setSmtpUsername(e.target.value)} />
- + setSmtpTo(e.target.value)} + type="password" + id="smtpPass" + placeholder="••••••••" + onChange={(e) => setSmtpPassword(e.target.value)} + /> +
+ +
+
+ + setSmtpFrom(e.target.value)} + /> +
+ +
+ + setSmtpTo(e.target.value)} + /> +
+
+
+ + )} + + {notificationType === "telegram" && ( +
+
+ + setTelegramToken(e.target.value)} + /> +
+
+ + setTelegramChatId(e.target.value)} + /> +
+
+ )} + + {notificationType === "discord" && ( +
+
+ + setDiscordWebhook(e.target.value)} + /> +
+
+ )} + + {notificationType === "gotify" && ( +
+
+ + setGotifyUrl(e.target.value)} + /> +
+ + setGotifyToken(e.target.value)} />
- - )} + )} - {notificationType === "telegram" && ( -
-
- - setTelegramToken(e.target.value)} - /> -
-
- - setTelegramChatId(e.target.value)} - /> -
-
- )} - - {notificationType === "discord" && ( -
-
- - setDiscordWebhook(e.target.value)} - /> -
-
- )} - - {notificationType === "gotify" && ( -
-
- - setGotifyUrl(e.target.value)} - /> + {notificationType === "ntfy" && ( +
- + setGotifyToken(e.target.value)} + onChange={(e) => setNtfyUrl(e.target.value)} + /> +
+ + setNtfyToken(e.target.value)} + /> +
+
+
+ )} + + {notificationType === "pushover" && ( +
+
+ + setPushoverUrl(e.target.value)} + /> +
+ +
+ + setPushoverToken(e.target.value)} + /> +
+ +
+ + setPushoverUser(e.target.value)} />
-
- )} - - {notificationType === "ntfy" && ( -
-
- - setNtfyUrl(e.target.value)} - /> -
- - setNtfyToken(e.target.value)} - /> -
-
-
- )} - - {notificationType === "pushover" && ( -
-
- - setPushoverUrl(e.target.value)} - /> -
- -
- - setPushoverToken(e.target.value)} - /> -
- -
- - setPushoverUser(e.target.value)} - /> -
-
- )} - + )} + +
Cancel @@ -765,7 +775,7 @@ export default function Settings() { )}
-

{notification.type}

+

{notification.name && notification.name !== "" ? notification.name : notification.type}

{notification.type === "smtp" && "Email notifications"} {notification.type === "telegram" && "Telegram bot alerts"}