From 6db60f111d2f0cbfbc22c406698697bbdf6896c6 Mon Sep 17 00:00:00 2001 From: killianlarcher Date: Sun, 18 Jan 2026 12:36:12 +0100 Subject: [PATCH] feat(ui): add preview for upcoming notification provider --- .../dashboard/admin/notifications/helpers.tsx | 938 ++++++++++-------- .../notifier/notifier-form/notifier-form.tsx | 47 +- 2 files changed, 544 insertions(+), 441 deletions(-) diff --git a/src/components/wrappers/dashboard/admin/notifications/helpers.tsx b/src/components/wrappers/dashboard/admin/notifications/helpers.tsx index cdaea43..71c1e6a 100644 --- a/src/components/wrappers/dashboard/admin/notifications/helpers.tsx +++ b/src/components/wrappers/dashboard/admin/notifications/helpers.tsx @@ -1,13 +1,19 @@ import {Mail} from "lucide-react"; -import type { SVGProps } from 'react'; +import type {SVGProps} from 'react'; export const getNotificationChannelIcon = (type: string) => { - const Icon = notificationTypes.find((t) => t.value === type)?.icon + const Icon = notificationProviders.find((t) => t.value === type)?.icon return Icon ? : null } +type NotificationProps = { + value: string + label: string + icon: any + preview?: boolean +} -export const notificationTypes = [ +export const notificationProviders: Array = [ {value: "smtp", label: "Email", icon: Mail}, {value: "slack", label: "Slack", icon: SlackIcon}, {value: "discord", label: "Discord", icon: DiscordIcon}, @@ -15,473 +21,543 @@ export const notificationTypes = [ {value: "gotify", label: "Gotify", icon: GotifyIcon}, {value: "ntfy", label: "ntfy.sh", icon: NtfyIcon}, {value: "webhook", label: "Webhook", icon: WebhookIcon}, + {value: "microsoft-teams", label: "Microsoft Teams", icon: MSTeamsIcon, preview: true} ] export function SlackIcon(props: SVGProps) { - return (); + return ( + + + + + ); } export function DiscordIcon(props: SVGProps) { - return (); + return ( + + ); } export function TelegramIcon(props: SVGProps) { - return (); + return ( + + + + + + + + + ); } - export function NtfyIcon(props: SVGProps) { - return ( - - - - - - - - - - - ) - -} - - -export function GotifyIcon(props: SVGProps) { - - return ( - - - - - - - - - - - - - - - - - - - - - + viewBox="0 0 512 512" + {...props} + > + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - ) + +} + + +export function GotifyIcon(props: SVGProps) { + + return ( + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } export function WebhookIcon(props: SVGProps) { return ( - - + + ) } +export function MSTeamsIcon(props: SVGProps) { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + ) +} + diff --git a/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-form.tsx b/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-form.tsx index 8cca508..3db99d1 100644 --- a/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-form.tsx +++ b/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-form.tsx @@ -40,7 +40,7 @@ import { NotifierTestChannelButton } from "@/components/wrappers/dashboard/common/notifier/notifier-form/notifier-test-channel-button"; import {useEffect} from "react"; -import {notificationTypes} from "@/components/wrappers/dashboard/admin/notifications/helpers"; +import {notificationProviders} from "@/components/wrappers/dashboard/admin/notifications/helpers"; import {cn} from "@/lib/utils"; import {Card} from "@/components/ui/card"; import {ArrowLeft} from "lucide-react"; @@ -93,29 +93,54 @@ export const NotifierForm = ({onSuccessAction, organization, defaultValues}: Not }); const provider = form.watch("provider"); - const selectedProviderDetails = notificationTypes.find(t => t.value === provider); + const selectedProviderDetails = notificationProviders.find(t => t.value === provider); if (isCreate && !provider) { return (
- {notificationTypes.map((type) => { + {notificationProviders.map((type) => { const Icon = type.icon; return ( { + if (type.preview) return; form.setValue("provider", type.value as any); form.setValue("config", {}); }} > -
- + {type.preview && ( +
+
+ coming soon +
+
+ )} +
+
- {type.label} + + {type.label} + + ); })}
@@ -132,7 +157,8 @@ export const NotifierForm = ({onSuccessAction, organization, defaultValues}: Not >
{selectedProviderDetails && ( -
+
)} @@ -163,7 +189,8 @@ export const NotifierForm = ({onSuccessAction, organization, defaultValues}: Not Channel Name - + @@ -174,7 +201,7 @@ export const NotifierForm = ({onSuccessAction, organization, defaultValues}: Not control={form.control} name="provider" render={({field}) => ( - + )} />