mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 08:32:18 +03:00
Tweaks (#22630)
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
* fix stage overlay size * add audio filter config and load audio labels * remove add button from object and audio labels in settings * tests * update classification docs * tweak wording * don't require restart for timestamp_style changes * add optional i18n prefix for select widgets * use i18n enum prefix for timestamp position * add i18n for all presets
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Select Widget - maps to shadcn/ui Select
|
||||
import type { WidgetProps } from "@rjsf/utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -21,9 +22,18 @@ export function SelectWidget(props: WidgetProps) {
|
||||
schema,
|
||||
} = props;
|
||||
|
||||
const { t } = useTranslation(["views/settings"]);
|
||||
const { enumOptions = [] } = options;
|
||||
const enumI18nPrefix = options["enumI18nPrefix"] as string | undefined;
|
||||
const fieldClassName = getSizedFieldClassName(options, "sm");
|
||||
|
||||
const getLabel = (option: { value: unknown; label: string }) => {
|
||||
if (enumI18nPrefix) {
|
||||
return t(`${enumI18nPrefix}.${option.value}`);
|
||||
}
|
||||
return option.label;
|
||||
};
|
||||
|
||||
return (
|
||||
<Select
|
||||
value={value?.toString() ?? ""}
|
||||
@@ -42,7 +52,7 @@ export function SelectWidget(props: WidgetProps) {
|
||||
<SelectContent>
|
||||
{enumOptions.map((option: { value: unknown; label: string }) => (
|
||||
<SelectItem key={String(option.value)} value={String(option.value)}>
|
||||
{option.label}
|
||||
{getLabel(option)}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
|
||||
Reference in New Issue
Block a user