import {UseFormReturn} from "react-hook-form"; import { NotifierSmtpForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/smtp.form"; import { NotifierSlackForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/slack.form"; import { NotifierDiscordForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/discord.form"; import { NotifierTelegramForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/telegram.form"; import { NotifierGotifyForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/gotify.form"; import { NotifierNtfyForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/ntfy.form"; import { NotifierWebhookForm } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/notifications/forms/webhook.form"; import { notificationProviders, } from "@/components/wrappers/dashboard/admin/channels/helpers/notification"; import {storageProviders} from "@/components/wrappers/dashboard/admin/channels/helpers/storage"; import {ForwardRefExoticComponent, JSX, RefAttributes, SVGProps} from "react"; import {LucideProps} from "lucide-react"; import { StorageS3Form } from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/providers/storages/forms/s3.form"; export type ChannelKind = "notification" | "storage"; export function getChannelTextBasedOnKind(kind: ChannelKind) { switch (kind) { case "notification": return "Notification"; case "storage": return "Storage"; default: return "Notification"; } } export type ProviderIconTypes = { value: string label: string icon: ForwardRefExoticComponent & RefAttributes> preview?: boolean } | { value: string label: string icon: (props: SVGProps) => JSX.Element preview?: boolean } export const providerIcons: ProviderIconTypes[] = [ ...notificationProviders, ...storageProviders, ]; export const getChannelIcon = (type: string) => { const Icon = providerIcons.find((t) => t.value === type)?.icon return Icon ? : null } export const renderChannelForm = (provider: string | undefined, form: UseFormReturn) => { switch (provider) { case "smtp": return ; case "slack": return ; case "discord": return ; case "telegram": return ; case "gotify": return ; case "ntfy": return ; case "webhook": return ; case "s3": return case "local": return <> default: return null; } };