Files
frigate/web/src/components/config-form/ConfigMessageBanner.tsx
T
dependabot[bot]andJosh Hawkins 74a5973f6d Bump i18next from 26.7.2 to 27.1.1 in /web (#24980)
* Bump i18next from 26.7.2 to 27.1.1 in /web

Bumps [i18next](https://github.com/i18next/i18next) from 26.7.2 to 27.1.1.
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v26.7.2...v27.1.1)

---
updated-dependencies:
- dependency-name: i18next
  dependency-version: 27.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* bump react-i18next to 18 and fix i18next 27 types

react-i18next 18 peers i18next >= 27.0.1, so the two move together.
i18next 27's TFunction no longer fits the hand-written t signatures in
the config form, and it rejects undefined as the options argument.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2026-11-15 11:39:59 -06:00

55 lines
1.5 KiB
TypeScript

import { useTranslation } from "react-i18next";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { LuInfo, LuTriangleAlert, LuCircleAlert } from "react-icons/lu";
import type {
ConditionalMessage,
MessageSeverity,
} from "./section-configs/types";
const severityVariantMap: Record<
MessageSeverity,
"info" | "warning" | "destructive"
> = {
info: "info",
warning: "warning",
error: "destructive",
};
function SeverityIcon({ severity }: { severity: MessageSeverity }) {
switch (severity) {
case "info":
return <LuInfo className="size-4 shrink-0" />;
case "warning":
return <LuTriangleAlert className="size-4 shrink-0" />;
case "error":
return <LuCircleAlert className="size-4 shrink-0" />;
}
}
type ConfigMessageBannerProps = {
messages: ConditionalMessage[];
};
export function ConfigMessageBanner({ messages }: ConfigMessageBannerProps) {
const { t } = useTranslation("views/settings");
if (messages.length === 0) return null;
return (
<div className="max-w-5xl space-y-2">
{messages.map((msg) => (
<Alert
key={msg.key}
variant={severityVariantMap[msg.severity]}
className="flex items-center [&>svg+div]:translate-y-0 [&>svg]:static [&>svg~*]:pl-2"
>
<SeverityIcon severity={msg.severity} />
<AlertDescription>
{t(msg.messageKey, msg.values ?? {})}
</AlertDescription>
</Alert>
))}
</div>
);
}