Files
coder/site/src/modules/notifications/utils.tsx
T
Bruno Quaresma 4ac41375a0 chore: replace MUI icons with Lucide icons - 15 (#17861)
AccountCircleOutlined -> CircleUserIcon
BugReportOutlined -> BugIcon
ChatOutlined -> MessageSquareIcon
ExitToAppOutlined -> LogOutIcon
LaunchOutlined -> SquareArrowOutUpRightIcon
MenuBook -> BookOpenTextIcon
OpenInNew -> EternalLinkIcon
EmailOutlined -> MailIcon
WebhookOutlined -> WebhookIcon
Business -> Building2Icon
Person -> UserIcon
2025-05-15 22:32:50 -03:00

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(
", ",
)}`,
);
};