Fix react-intl in table head

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-09-15 14:32:50 +02:00
parent 2496f2559b
commit 566de24d88
3 changed files with 6 additions and 3 deletions

View File

@ -54,7 +54,10 @@ const FieldPicker = ({ layout }) => {
{allAllowedHeaders.map(header => {
return (
<Option key={header.name} value={header.name}>
{formatMessage(header.intlLabel)}
{formatMessage({
id: header.intlLabel.id || header.name,
defaultMessage: header.intlLabel.defaultMessage || header.name,
})}
</Option>
);
})}

View File

@ -52,7 +52,7 @@ const TableHead = ({
{ id: 'components.TableHeader.sort', defaultMessage: 'Sort on {label}' },
{ label }
);
const intlLabel = formatMessage({ id: label, defaultMessage: label });
const intlLabel = formatMessage({ id: label || name, defaultMessage: label || name });
const handleClickSort = (shouldAllowClick = true) => {
if (isSortable && shouldAllowClick) {

View File

@ -45,7 +45,7 @@ const AttributeTag = ({ attribute, filter, onClick, operator, value }) => {
return (
<Box padding={1} onClick={handleClick}>
<Tag icon={<Close />}>
{attribute.metadatas.label}&nbsp;
{attribute.metadatas.label || attribute.name}&nbsp;
{formatMessage({
id: `components.FilterOptions.FILTER_TYPES.${operator}`,
defaultMessage: operator,