import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { LuInfo, LuTriangleAlert, LuCircleAlert, LuExternalLink, } from "react-icons/lu"; import { useDocDomain } from "@/hooks/use-doc-domain"; import type { MessageSeverity } from "./section-configs/types"; const severityVariantMap: Record< MessageSeverity, "info" | "warning" | "destructive" > = { info: "info", warning: "warning", error: "destructive", }; function SeverityIcon({ severity }: { severity: string }) { switch (severity) { case "info": return ; case "warning": return ; case "error": return ; default: return ; } } type ConfigFieldMessageProps = { messageKey: string; severity: string; values?: Record; docLink?: string; }; export function ConfigFieldMessage({ messageKey, severity, values, docLink, }: ConfigFieldMessageProps) { const { t } = useTranslation(["views/settings", "common"]); const { getLocaleDocUrl } = useDocDomain(); return (
{t(messageKey, values)} {docLink && ( {t("readTheDocumentation", { ns: "common" })} )}
); }