Fix PR feedback

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-03-15 10:50:41 +01:00
parent 534dba09ad
commit fe7dc29678

View File

@ -4,7 +4,7 @@ import { Globe, GlobeCrossed } from '@buffetjs/icons';
import { getTrad } from '../utils'; import { getTrad } from '../utils';
const enhanceRelationLayout = (layout, locale) => const enhanceRelationLayout = (layout, locale) =>
layout.reduce((acc, current) => { layout.map(current => {
const labelIcon = { const labelIcon = {
title: { title: {
id: getTrad('Field.localized'), id: getTrad('Field.localized'),
@ -21,13 +21,11 @@ const enhanceRelationLayout = (layout, locale) =>
}; };
} }
acc.push({ ...current, labelIcon, queryInfos }); return { ...current, labelIcon, queryInfos };
});
return acc;
}, []);
const enhanceEditLayout = layout => const enhanceEditLayout = layout =>
layout.reduce((rows, row) => { layout.map(row => {
const enhancedRow = row.reduce((acc, field) => { const enhancedRow = row.reduce((acc, field) => {
const hasI18nEnabled = get( const hasI18nEnabled = get(
field, field,
@ -50,10 +48,8 @@ const enhanceEditLayout = layout =>
return acc; return acc;
}, []); }, []);
rows.push(enhancedRow); return enhancedRow;
});
return rows;
}, []);
const enhanceComponentsLayout = (components, locale) => { const enhanceComponentsLayout = (components, locale) => {
return Object.keys(components).reduce((acc, current) => { return Object.keys(components).reduce((acc, current) => {
@ -74,7 +70,7 @@ const enhanceComponentsLayout = (components, locale) => {
}; };
const enhanceComponentLayoutForRelations = (layout, locale) => const enhanceComponentLayoutForRelations = (layout, locale) =>
layout.reduce((rows, row) => { layout.map(row => {
const enhancedRow = row.reduce((acc, field) => { const enhancedRow = row.reduce((acc, field) => {
if ( if (
get(field, ['fieldSchema', 'type']) === 'relation' && get(field, ['fieldSchema', 'type']) === 'relation' &&
@ -95,10 +91,8 @@ const enhanceComponentLayoutForRelations = (layout, locale) =>
return acc; return acc;
}, []); }, []);
rows.push(enhancedRow); return enhancedRow;
});
return rows;
}, []);
const extendCMEditViewLayoutMiddleware = () => () => next => action => { const extendCMEditViewLayoutMiddleware = () => () => next => action => {
if (action.type !== 'ContentManager/EditViewLayoutManager/SET_LAYOUT') { if (action.type !== 'ContentManager/EditViewLayoutManager/SET_LAYOUT') {