update: localization attribute filter

This commit is contained in:
smoothdvd 2022-07-26 14:22:35 +08:00 committed by GitHub
parent b1ce10f7f8
commit 0c37e31344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useIntl } from 'react-intl';
import useAllowedAttributes from './hooks/useAllowedAttributes';
import Filters from './Filters';
const AttributeFilter = ({ contentType, slug, metadatas }) => {
const { formatMessage } = useIntl();
const allowedAttributes = useAllowedAttributes(contentType, slug);
const displayedFilters = allowedAttributes.map(name => {
const attribute = contentType.attributes[name];
@ -18,7 +20,7 @@ const AttributeFilter = ({ contentType, slug, metadatas }) => {
return {
name,
metadatas: { label },
metadatas: { label: formatMessage({ id: label }) },
fieldSchema: { type, options, mainField },
trackedEvent,
};