From 63958ca51af534c8838189dd2ea0e546d67ba1b7 Mon Sep 17 00:00:00 2001 From: Rafal Dziegielewski Date: Thu, 18 Jan 2024 19:18:42 +0100 Subject: [PATCH] fix: add missing availableValues translation in filters --- .../components/property-type/default-type/filter.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/components/property-type/default-type/filter.tsx b/src/frontend/components/property-type/default-type/filter.tsx index 15ec90ab3..24829409d 100644 --- a/src/frontend/components/property-type/default-type/filter.tsx +++ b/src/frontend/components/property-type/default-type/filter.tsx @@ -4,9 +4,11 @@ import { FormGroup, Input, Select } from '@adminjs/design-system' import allowOverride from '../../../hoc/allow-override.js' import { FilterPropertyProps } from '../base-property-props.js' import PropertyLabel from '../utils/property-label/property-label.js' +import { useTranslation } from '../../../hooks/use-translation.js' const Filter: React.FC = (props) => { const { property, onChange, filter } = props + const { translateProperty } = useTranslation() const handleInputChange = (event) => { onChange(property.path, event.target.value) @@ -21,13 +23,17 @@ const Filter: React.FC = (props) => { const filterKey = `filter-${property.path}` const value = filter[property.path] || '' if (property.availableValues) { + const availableValues = property.availableValues.map((v) => ({ + ...v, + label: translateProperty(v.label), + })) const selected = property.availableValues.find((av) => av.value === value) return (