Skip to content

NVR with realtime local object detection for IP cameras

feat: add search filter group audio i18n (#20760)

GuoQing Liuaff82f809c54
diff --git a/web/src/components/filter/SearchFilterGroup.tsx b/web/src/components/filter/SearchFilterGroup.tsx
index b96ed7dd7a..1426bb5f9a 100644
--- a/web/src/components/filter/SearchFilterGroup.tsx
+++ b/web/src/components/filter/SearchFilterGroup.tsx
@@ -348,6 +348,26 @@ export function GeneralFilterContent({
onClose,
}: GeneralFilterContentProps) {
const { t } = useTranslation(["components/filter"]);
+ const { data: config } = useSWR<FrigateConfig>("config", {
+ revalidateOnFocus: false,
+ });
+
+ const allAudioListenLabels = useMemo<string[]>(() => {
+ if (!config) {
+ return [];
+ }
+
+ const labels = new Set<string>();
+ Object.values(config.cameras).forEach((camera) => {
+ if (camera?.audio?.enabled) {
+ camera.audio.listen.forEach((label) => {
+ labels.add(label);
+ });
+ }
+ });
+ return [...labels].sort();
+ }, [config]);
+
return (
<>
<div className="overflow-x-hidden">
@@ -373,7 +393,10 @@ export function GeneralFilterContent({
{allLabels.map((item) => (
<FilterSwitch
key={item}
- label={getTranslatedLabel(item)}
+ label={getTranslatedLabel(
+ item,
+ allAudioListenLabels.includes(item) ? "audio" : "object",
+ )}
isChecked={currentLabels?.includes(item) ?? false}
onCheckedChange={(isChecked) => {
if (isChecked) {