mirror of
https://github.com/coder/coder.git
synced 2026-11-19 18:51:12 +08:00
AccountCircleOutlined -> CircleUserIcon BugReportOutlined -> BugIcon ChatOutlined -> MessageSquareIcon ExitToAppOutlined -> LogOutIcon LaunchOutlined -> SquareArrowOutUpRightIcon MenuBook -> BookOpenTextIcon OpenInNew -> EternalLinkIcon EmailOutlined -> MailIcon WebhookOutlined -> WebhookIcon Business -> Building2Icon Person -> UserIcon
30 lines
811 B
TypeScript
30 lines
811 B
TypeScript
import { MailIcon } from "lucide-react";
|
|
import { WebhookIcon } from "lucide-react";
|
|
|
|
// TODO: This should be provided by the auto generated types from codersdk
|
|
const notificationMethods = ["smtp", "webhook"] as const;
|
|
|
|
export type NotificationMethod = (typeof notificationMethods)[number];
|
|
|
|
export const methodIcons: Record<NotificationMethod, typeof MailIcon> = {
|
|
smtp: MailIcon,
|
|
webhook: WebhookIcon,
|
|
};
|
|
|
|
export const methodLabels: Record<NotificationMethod, string> = {
|
|
smtp: "SMTP",
|
|
webhook: "Webhook",
|
|
};
|
|
|
|
export const castNotificationMethod = (value: string) => {
|
|
if (notificationMethods.includes(value as NotificationMethod)) {
|
|
return value as NotificationMethod;
|
|
}
|
|
|
|
throw new Error(
|
|
`Invalid notification method: ${value}. Accepted values: ${notificationMethods.join(
|
|
", ",
|
|
)}`,
|
|
);
|
|
};
|