{
const handleClick = e => {
e.preventDefault();
- push(
- '/plugins/content-type-builder/content-types/plugins::users-permissions.user?modalType=contentType&kind=collectionType&actionType=create&settingType=base&forTarget=contentType&headerId=content-type-builder.modalForm.contentType.header-create&header_icon_isCustom_1=false&header_icon_name_1=contentType&header_label_1=null'
- );
+ push('/plugins/content-type-builder/content-types/create-content-type');
};
const hasAlreadyCreatedContentTypes = useMemo(() => {
diff --git a/packages/core/content-type-builder/admin/src/components/AttributeIcon/index.js b/packages/core/content-type-builder/admin/src/components/AttributeIcon/index.js
index be7973d946..5a410f02bf 100644
--- a/packages/core/content-type-builder/admin/src/components/AttributeIcon/index.js
+++ b/packages/core/content-type-builder/admin/src/components/AttributeIcon/index.js
@@ -23,6 +23,7 @@ import { pxToRem } from '@strapi/helper-plugin';
const iconByTypes = {
biginteger: Numbers,
boolean: Boolean,
+ collectionType: CT,
component: Component,
contentType: CT,
date: Date,
@@ -58,11 +59,9 @@ const IconBox = styled(Box)`
`;
const AttributeIcon = ({ type, ...rest }) => {
- const iconType = type === 'collectionType' ? 'contentType' : type;
+ const Compo = iconByTypes[type];
- const Compo = iconByTypes[iconType];
-
- if (!iconByTypes[iconType]) {
+ if (!iconByTypes[type]) {
return null;
}
diff --git a/packages/core/content-type-builder/admin/src/components/AttributeOptions/AttributeOption/index.js b/packages/core/content-type-builder/admin/src/components/AttributeOptions/AttributeOption/index.js
index 3c99462765..d2939602ea 100644
--- a/packages/core/content-type-builder/admin/src/components/AttributeOptions/AttributeOption/index.js
+++ b/packages/core/content-type-builder/admin/src/components/AttributeOptions/AttributeOption/index.js
@@ -31,18 +31,12 @@ const AttributeOption = ({ type }) => {
const header_info_category_1 = query.header_info_category_1 || null;
const header_info_name_1 = query.header_info_name_1 || null;
const header_label_2 = query.header_label_2 || null;
- const header_icon_name_2 = query.header_icon_name_2 || null;
- const header_icon_isCustom_2 = query.header_icon_isCustom_2 || null;
const header_info_category_2 = query.header_info_category_2 || null;
const header_info_name_2 = query.header_info_name_2 || null;
const header_label_3 = query.header_label_3 || null;
- const header_icon_name_3 = query.header_icon_name_3 || null;
- const header_icon_isCustom_3 = query.header_icon_isCustom_3 || null;
const header_info_category_3 = query.header_info_category_3 || null;
const header_info_name_3 = query.header_info_name_3 || null;
const header_label_4 = query.header_label_4 || null;
- const header_icon_name_4 = query.header_icon_name_4 || null;
- const header_icon_isCustom_4 = query.header_icon_isCustom_4 || null;
const header_info_category_4 = query.header_info_category_4 || null;
const header_info_name_4 = query.header_info_name_4 || null;
@@ -59,22 +53,14 @@ const AttributeOption = ({ type }) => {
header_info_name_1,
header_info_category_1,
header_label_2,
- header_icon_name_2,
- header_icon_isCustom_2,
header_info_name_2,
header_info_category_2,
header_label_3,
- header_icon_name_3,
- header_icon_isCustom_3,
header_info_name_3,
header_info_category_3,
header_label_4,
- header_icon_name_4,
- header_icon_isCustom_4,
header_info_name_4,
header_info_category_4,
- header_icon_isCustom_1: false,
- header_icon_name_1: type,
});
if (forTarget === 'contentType') {
diff --git a/packages/core/content-type-builder/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js b/packages/core/content-type-builder/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js
index c120758026..35bc7e1ade 100644
--- a/packages/core/content-type-builder/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js
+++ b/packages/core/content-type-builder/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js
@@ -39,13 +39,9 @@ const useContentTypeBuilderMenu = () => {
id: getTrad('modalForm.header.categories'),
defaultMessage: 'Categories',
}),
- header_icon_name_1: 'component',
- header_icon_isCustom_1: false,
header_info_category_1: null,
header_info_name_1: null,
header_label_2: data.name,
- header_icon_name_2: null,
- header_icon_isCustom_2: false,
header_info_category_2: null,
header_info_name_2: null,
@@ -86,8 +82,6 @@ const useContentTypeBuilderMenu = () => {
settingType: 'base',
forTarget: modalType,
headerId: getTrad(`modalForm.${type}.header-create`),
- header_icon_isCustom_1: 'false',
- header_icon_name_1: type,
header_label_1: 'null',
});
push({
diff --git a/packages/core/content-type-builder/admin/src/components/FormModal/index.js b/packages/core/content-type-builder/admin/src/components/FormModal/index.js
index db0d415d26..97d33df085 100644
--- a/packages/core/content-type-builder/admin/src/components/FormModal/index.js
+++ b/packages/core/content-type-builder/admin/src/components/FormModal/index.js
@@ -130,28 +130,18 @@ const FormModal = () => {
const settingType = query.get('settingType');
const headerId = query.get('headerId');
const header_label_1 = query.get('header_label_1');
- const header_icon_name_1 = query.get('header_icon_name_1');
- const header_icon_isCustom_1 = query.get('header_icon_isCustom_1');
const header_info_category_1 = query.get('header_info_category_1');
const header_info_name_1 = query.get('header_info_name_1');
const header_label_2 = query.get('header_label_2');
- const header_icon_name_2 = query.get('header_icon_name_2');
- const header_icon_isCustom_2 = query.get('header_icon_isCustom_2');
const header_info_category_2 = query.get('header_info_category_2');
const header_info_name_2 = query.get('header_info_name_2');
const header_label_3 = query.get('header_label_3');
- const header_icon_name_3 = query.get('header_icon_name_3');
- const header_icon_isCustom_3 = query.get('header_icon_isCustom_3');
const header_info_category_3 = query.get('header_info_category_3');
const header_info_name_3 = query.get('header_info_name_3');
const header_label_4 = query.get('header_label_4');
- const header_icon_name_4 = query.get('header_icon_name_4');
- const header_icon_isCustom_4 = query.get('header_icon_isCustom_4');
const header_info_category_4 = query.get('header_info_category_4');
const header_info_name_4 = query.get('header_info_name_4');
const header_label_5 = query.get('header_label_5');
- const header_icon_name_5 = query.get('header_icon_name_5');
- const header_icon_isCustom_5 = query.get('header_icon_isCustom_5');
const header_info_category_5 = query.get('header_info_category_5');
const header_info_name_5 = query.get('header_info_name_5');
const step = query.get('step');
@@ -173,28 +163,18 @@ const FormModal = () => {
step,
targetUid,
header_label_1,
- header_icon_name_1,
- header_icon_isCustom_1,
header_info_name_1,
header_info_category_1,
header_label_2,
- header_icon_name_2,
- header_icon_isCustom_2,
header_info_name_2,
header_info_category_2,
header_label_3,
- header_icon_name_3,
- header_icon_isCustom_3,
header_info_name_3,
header_info_category_3,
header_label_4,
- header_icon_name_4,
- header_icon_isCustom_4,
header_info_name_4,
header_info_category_4,
header_label_5,
- header_icon_name_5,
- header_icon_isCustom_5,
header_info_name_5,
header_info_category_5,
headerId,
@@ -287,6 +267,7 @@ const FormModal = () => {
modalType,
data: {
name,
+ // FIXME
collectionName,
draftAndPublish,
kind,
@@ -624,17 +605,6 @@ const FormModal = () => {
await checkFormValidity();
sendButtonAddMoreFieldEvent(shouldContinue);
const targetUid = state.forTarget === 'components' ? state.targetUid : uid;
- let headerIcon;
-
- if (state.forTarget === 'contentType') {
- const currentKind = get(allDataSchema, ['contentType', 'schema', 'kind'], 'contentType');
-
- headerIcon = state.kind || currentKind;
- } else if (state.forTarget === 'component') {
- headerIcon = 'component';
- } else {
- headerIcon = get(allDataSchema, ['components', state.targetUid, 'schema', 'icon'], '');
- }
// Remove the last header when editing
if (state.actionType === 'edit') {
@@ -649,6 +619,7 @@ const FormModal = () => {
if (isCreating) {
createSchema({ ...modifiedData, kind: state.kind }, state.modalType, uid);
} else {
+ // TODO : add comments
if (canEditContentType(allDataSchema, modifiedData)) {
push({ search: '' });
submitData(modifiedData);
@@ -669,8 +640,6 @@ const FormModal = () => {
forTarget: state.forTarget,
targetUid,
header_label_1: modifiedData.name,
- header_icon_name_1: headerIcon,
- header_icon_isCustom_1: null,
}),
});
} else if (isCreatingComponent) {
@@ -687,8 +656,6 @@ const FormModal = () => {
forTarget: state.forTarget,
targetUid: componentUid,
header_label_1: modifiedData.name,
- header_icon_name_1: 'contentType',
- header_icon_isCustom_1: null,
}),
pathname: `/plugins/${pluginId}/component-categories/${category}/${componentUid}`,
});
@@ -739,8 +706,6 @@ const FormModal = () => {
actionType: 'create',
...headersObject,
header_label_2: modifiedData.name,
- header_icon_name_2: null,
- header_icon_isCustom_2: false,
});
const nextSearch = isDynamicZoneAttribute
? dzSearch
@@ -750,8 +715,6 @@ const FormModal = () => {
forTarget: state.forTarget,
targetUid,
...headersObject,
- header_icon_isCustom_1: !['contentType', 'component'].includes(state.forTarget),
- header_icon_name_1: headerIcon,
},
shouldContinue
);
@@ -786,8 +749,6 @@ const FormModal = () => {
attributeType: 'component',
step: '2',
...headersObject,
- header_icon_isCustom_1: !['contentType', 'component'].includes(state.forTarget),
- header_icon_name_1: headerIcon,
};
push({
@@ -827,8 +788,6 @@ const FormModal = () => {
forTarget: state.forTarget,
targetUid: state.targetUid,
...headersObject,
- header_icon_isCustom_1: !['contentType', 'component'].includes(state.forTarget),
- header_icon_name_1: headerIcon,
};
push({ search: makeSearch(nextSearch, shouldContinue) });
@@ -855,8 +814,6 @@ const FormModal = () => {
attributeType: 'component',
step: '2',
...headersObject,
- header_icon_isCustom_1: false,
- header_icon_name_1: 'component',
};
trackUsage('willCreateComponentFromAttributesModal');
@@ -909,11 +866,7 @@ const FormModal = () => {
forTarget: 'components',
targetUid: componentUid,
...headersObject,
- header_icon_isCustom_1: true,
- header_icon_name_1: componentToCreate.icon,
[`header_label_${nextHeaderIndex}`]: modifiedData.name,
- [`header_icon_name_${nextHeaderIndex}`]: 'component',
- [`header_icon_isCustom_${nextHeaderIndex}`]: false,
[`header_info_category_${nextHeaderIndex}`]: category,
[`header_info_name_${nextHeaderIndex}`]: componentToCreate.name,
};
@@ -961,11 +914,7 @@ const FormModal = () => {
forTarget: 'components',
targetUid: componentUid,
...headersObject,
- header_icon_isCustom_1: true,
- header_icon_name_1: modifiedData.componentToCreate.icon,
[`header_label_${nextHeaderIndex}`]: modifiedData.name,
- [`header_icon_name_${nextHeaderIndex}`]: 'component',
- [`header_icon_isCustom_${nextHeaderIndex}`]: false,
[`header_info_category_${nextHeaderIndex}`]: category,
[`header_info_name_${nextHeaderIndex}`]: modifiedData.componentToCreate.name,
};
@@ -999,6 +948,7 @@ const FormModal = () => {
});
}
};
+
const handleClosed = () => {
// Close the modal
push({ search: '' });
@@ -1065,6 +1015,11 @@ const FormModal = () => {
return null;
}
+ // FIXME
+ if (!state.modalType) {
+ return null;
+ }
+
const formToDisplay = get(forms, [state.modalType, 'form'], {
advanced: () => ({
sections: [],
@@ -1138,7 +1093,15 @@ const FormModal = () => {
return (
<>
-
+
{isPickingAttribute && (
{
const array = Object.keys(obj).reduce((acc, current) => {
const splitted = current.split('_');
@@ -16,11 +10,7 @@ const createHeadersArray = obj => {
const currentKeysIndex = parseInt(splitted[splitted.length - 1] - 1, 10);
const path = [currentKeysIndex, ...currentKeys.filter(key => key !== 'header')];
- let value = obj[current];
-
- if (current.includes('isCustom')) {
- value = obj[current] === 'true';
- }
+ const value = obj[current];
set(acc, path, value);
}
diff --git a/packages/core/content-type-builder/admin/src/components/FormModal/utils/staticData.js b/packages/core/content-type-builder/admin/src/components/FormModal/utils/staticData.js
index bbb069f0ed..caa537d2d8 100644
--- a/packages/core/content-type-builder/admin/src/components/FormModal/utils/staticData.js
+++ b/packages/core/content-type-builder/admin/src/components/FormModal/utils/staticData.js
@@ -12,28 +12,18 @@ const INITIAL_STATE_DATA = {
targetUid: null,
headerId: null,
header_label_1: null,
- header_icon_name_1: null,
- header_icon_isCustom_1: null,
header_info_category_1: null,
header_info_name_1: null,
header_label_2: null,
- header_icon_name_2: null,
- header_icon_isCustom_2: null,
header_info_category_2: null,
header_info_name_2: null,
header_label_3: null,
- header_icon_name_3: null,
- header_icon_isCustom_3: null,
header_info_category_3: null,
header_info_name_3: null,
header_label_4: null,
- header_icon_name_4: null,
- header_icon_isCustom_4: null,
header_info_category_4: null,
header_info_name_4: null,
header_label_5: null,
- header_icon_name_5: null,
- header_icon_isCustom_5: null,
header_info_category_5: null,
header_info_name_5: null,
};
diff --git a/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersArray.test.js b/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersArray.test.js
index 1cbe4a9638..a4d997f85e 100644
--- a/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersArray.test.js
+++ b/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersArray.test.js
@@ -15,18 +15,12 @@ describe('FormModal | utils | createHeadersArray', () => {
targetUid: null,
headerId: null,
header_label_1: null,
- header_icon_name_1: null,
- header_icon_isCustom_1: null,
header_info_category_1: null,
header_info_name_1: null,
header_label_2: null,
- header_icon_name_2: null,
- header_icon_isCustom_2: null,
header_info_category_2: null,
header_info_name_2: null,
header_label_3: null,
- header_icon_name_3: null,
- header_icon_isCustom_3: null,
header_info_category_3: null,
header_info_name_3: null,
};
@@ -49,28 +43,19 @@ describe('FormModal | utils | createHeadersArray', () => {
targetUid: null,
headerId: null,
header_label_1: 'restaurant',
- header_icon_name_1: 'contentType',
- header_icon_isCustom_1: 'false',
header_info_category_1: null,
header_info_name_1: null,
header_label_2: null,
- header_icon_name_2: null,
- header_icon_isCustom_2: null,
header_info_category_2: null,
header_info_name_2: null,
header_label_3: null,
- header_icon_name_3: null,
- header_icon_isCustom_3: null,
header_info_category_3: null,
header_info_name_3: null,
};
const expected = [
{
label: 'restaurant',
- icon: {
- name: 'contentType',
- isCustom: false,
- },
+
info: {
name: null,
category: null,
@@ -97,18 +82,12 @@ describe('FormModal | utils | createHeadersArray', () => {
targetUid: null,
headerId: null,
header_label_1: 'restaurant',
- header_icon_name_1: 'bool',
- header_icon_isCustom_1: 'true',
header_info_category_1: null,
header_info_name_1: null,
header_label_2: 'closing period',
- header_icon_name_2: null,
- header_icon_isCustom_2: null,
header_info_category_2: 'default',
header_info_name_2: 'closingperiod',
header_label_3: null,
- header_icon_name_3: null,
- header_icon_isCustom_3: null,
header_info_category_3: null,
header_info_name_3: null,
};
@@ -116,10 +95,7 @@ describe('FormModal | utils | createHeadersArray', () => {
const expected = [
{
label: 'restaurant',
- icon: {
- name: 'bool',
- isCustom: true,
- },
+
info: {
name: null,
category: null,
@@ -127,10 +103,7 @@ describe('FormModal | utils | createHeadersArray', () => {
},
{
label: 'closing period',
- icon: {
- name: null,
- isCustom: false,
- },
+
info: {
name: 'closingperiod',
category: 'default',
diff --git a/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersObjectFromArray.test.js b/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersObjectFromArray.test.js
index 8acf3a881c..18061d5428 100644
--- a/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersObjectFromArray.test.js
+++ b/packages/core/content-type-builder/admin/src/components/FormModal/utils/tests/createHeadersObjectFromArray.test.js
@@ -5,10 +5,7 @@ describe('FormModal | utils | createHeadersArray', () => {
const data = [
{
label: 'test',
- icon: {
- name: 'contentType',
- isCustom: false,
- },
+
info: {
name: null,
category: null,
@@ -16,10 +13,7 @@ describe('FormModal | utils | createHeadersArray', () => {
},
{
label: 'test2',
- icon: {
- name: 'book',
- isCustom: true,
- },
+
info: {
name: 'something',
category: 'default',
@@ -29,13 +23,11 @@ describe('FormModal | utils | createHeadersArray', () => {
const expected = {
header_label_1: 'test',
- header_icon_name_1: 'contentType',
- header_icon_isCustom_1: false,
+
header_info_name_1: null,
header_info_category_1: null,
header_label_2: 'test2',
- header_icon_name_2: 'book',
- header_icon_isCustom_2: true,
+
header_info_name_2: 'something',
header_info_category_2: 'default',
};
diff --git a/packages/core/content-type-builder/admin/src/components/FormModalHeader/index.js b/packages/core/content-type-builder/admin/src/components/FormModalHeader/index.js
index 22710dbd51..3da0da6445 100644
--- a/packages/core/content-type-builder/admin/src/components/FormModalHeader/index.js
+++ b/packages/core/content-type-builder/admin/src/components/FormModalHeader/index.js
@@ -16,6 +16,7 @@ import { Row } from '@strapi/parts/Row';
import { Stack } from '@strapi/parts/Stack';
import { ButtonText } from '@strapi/parts/Text';
import styled from 'styled-components';
+import useDataManager from '../../hooks/useDataManager';
import AttributeIcon from '../AttributeIcon';
const IconBox = styled(Box)`
@@ -24,8 +25,49 @@ const IconBox = styled(Box)`
}
`;
-const FormModalHeader = ({ headerId, headers }) => {
+const FormModalHeader = ({
+ attributeType,
+ contentTypeKind,
+ forTarget,
+ headerId,
+ headers,
+ modalType,
+ targetUid,
+}) => {
const { formatMessage } = useIntl();
+ const { modifiedData } = useDataManager();
+
+ let icon;
+ let isFontAwesomeIcon = false;
+
+ if (modalType === 'chooseAttribute') {
+ const schema = modifiedData[forTarget][targetUid] || modifiedData[forTarget];
+
+ if (forTarget === 'components') {
+ icon = schema.schema.icon;
+ isFontAwesomeIcon = true;
+ } else if (forTarget === 'component') {
+ icon = 'component';
+ } else {
+ icon = schema.schema.kind;
+ }
+ }
+
+ if (modalType === 'contentType') {
+ icon = contentTypeKind;
+ }
+
+ if (['component', 'editCategory'].includes(modalType)) {
+ icon = 'component';
+ }
+
+ if (modalType === 'addComponentToDynamicZone') {
+ icon = 'dynamiczone';
+ }
+
+ if (modalType === 'attribute') {
+ icon = attributeType;
+ }
// TODO refacto
// Editing a content type or component
@@ -34,7 +76,7 @@ const FormModalHeader = ({ headerId, headers }) => {
-
+
@@ -47,15 +89,14 @@ const FormModalHeader = ({ headerId, headers }) => {
}
const breadcrumbsLabel = headers.map(({ label }) => label).join(',');
- const { name, isCustom } = headers[0].icon;
return (
- {!isCustom && }
- {isCustom && (
+ {!isFontAwesomeIcon && }
+ {isFontAwesomeIcon && (
-
+
)}
@@ -82,10 +123,16 @@ const FormModalHeader = ({ headerId, headers }) => {
};
FormModalHeader.defaultProps = {
+ attributeType: null,
+ contentTypeKind: null,
headerId: null,
+ targetUid: null,
};
FormModalHeader.propTypes = {
+ attributeType: PropTypes.string,
+ contentTypeKind: PropTypes.string,
+ forTarget: PropTypes.oneOf(['contentType', 'component', 'components']).isRequired,
headerId: PropTypes.string,
headers: PropTypes.arrayOf(
PropTypes.shape({
@@ -93,6 +140,8 @@ FormModalHeader.propTypes = {
label: PropTypes.string.isRequired,
})
).isRequired,
+ modalType: PropTypes.string.isRequired,
+ targetUid: PropTypes.string,
};
export default FormModalHeader;
diff --git a/packages/core/content-type-builder/admin/src/components/List/index.js b/packages/core/content-type-builder/admin/src/components/List/index.js
index bd41e2d5a6..fa866873c8 100644
--- a/packages/core/content-type-builder/admin/src/components/List/index.js
+++ b/packages/core/content-type-builder/admin/src/components/List/index.js
@@ -50,11 +50,7 @@ function List({
const { openModalAddField } = useListView();
const onClickAddField = () => {
trackUsage('hasClickedCTBAddFieldBanner');
- const firstComponentIcon = get(
- modifiedData,
- ['components', firstLoopComponentUid, 'schema', 'icon'],
- ''
- );
+
const firstComponentCategory = get(
modifiedData,
['components', firstLoopComponentUid, 'category'],
@@ -75,39 +71,21 @@ function List({
['components', secondLoopComponentUid, 'schema', 'name'],
null
);
- const secondComponentIcon = get(
- modifiedData,
- ['components', secondLoopComponentUid, 'schema', 'icon'],
- ''
- );
- const headerIconName1 =
- editTarget === 'contentType'
- ? get(modifiedData, ['contentType', 'schema', 'kind'], null)
- : editTarget;
let firstHeaderObject = {
header_label_1: mainTypeName,
- header_icon_name_1: headerIconName1,
- header_icon_isCustom_1: false,
header_info_category_1: null,
header_info_name_1: null,
};
let secondHeaderObject = {
header_label_2: firstLoopComponentName,
- header_icon_name_2: 'component',
- header_icon_isCustom_2: false,
header_info_category_2: firstComponentCategory,
header_info_name_2: firstComponentFriendlyName,
};
let thirdHeaderObject = {
- header_icon_name_3: 'component',
- header_icon_isCustom_3: false,
- header_info_category_3: secondComponentCategory,
header_info_name_3: secondComponentFriendlyName,
};
let fourthHeaderObject = {
- header_icon_name_4: null,
- header_icon_isCustom_4: false,
header_info_category_4: secondComponentCategory,
header_info_name_4: secondComponentFriendlyName,
};
@@ -115,20 +93,15 @@ function List({
if (firstLoopComponentName) {
firstHeaderObject = {
...firstHeaderObject,
- header_icon_name_1: firstComponentIcon,
- header_icon_isCustom_1: true,
};
}
if (secondLoopComponentUid) {
firstHeaderObject = {
...firstHeaderObject,
- header_icon_name_1: secondComponentIcon,
- header_icon_isCustom_1: true,
};
thirdHeaderObject = {
...thirdHeaderObject,
- header_label_3: secondLoopComponentName,
};
}
@@ -136,14 +109,11 @@ function List({
secondHeaderObject = {
...secondHeaderObject,
header_label_2: dzName,
- header_icon_name_2: 'dynamiczone',
- header_icon_isCustom_2: false,
header_info_category_2: null,
header_info_name_2: null,
};
thirdHeaderObject = {
...thirdHeaderObject,
- header_icon_name_3: isNestedInDZComponent ? 'component' : null,
header_label_3: firstLoopComponentName,
header_info_category_3: firstComponentCategory,
header_info_name_3: firstComponentFriendlyName,
diff --git a/packages/core/content-type-builder/admin/src/components/ListRow/index.js b/packages/core/content-type-builder/admin/src/components/ListRow/index.js
index e575a77fb8..0a81f41e4f 100644
--- a/packages/core/content-type-builder/admin/src/components/ListRow/index.js
+++ b/packages/core/content-type-builder/admin/src/components/ListRow/index.js
@@ -12,7 +12,6 @@ import DeleteIcon from '@strapi/icons/DeleteIcon';
import { stopPropagation, onRowClick } from '@strapi/helper-plugin';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import useDataManager from '../../hooks/useDataManager';
-import getAttributeDisplayedType from '../../utils/getAttributeDisplayedType';
import getTrad from '../../utils/getTrad';
import Curve from '../../icons/Curve';
import UpperFist from '../UpperFirst';
@@ -74,37 +73,26 @@ function ListRow({
);
const attrType = type;
- const icoType = getAttributeDisplayedType(attrType);
let firstHeaderObject = {
header_label_1: mainTypeName,
- header_icon_name_1: icoType,
- header_icon_isCustom_1: false,
header_info_category_1: null,
header_info_name_1: null,
};
let secondHeaderObject = {
header_label_2: name,
- header_icon_name_2: null,
- header_icon_isCustom_2: false,
header_info_category_2: null,
header_info_name_2: null,
};
let thirdHeaderObject = {
- header_icon_name_3: 'component',
- header_icon_isCustom_3: false,
header_info_category_3: null,
header_info_name_3: null,
};
let fourthHeaderObject = {
- header_icon_name_4: null,
- header_icon_isCustom_4: false,
header_info_category_4: null,
header_info_name_4: null,
};
let fifthHeaderObject = {
- header_icon_name_5: null,
- header_icon_isCustom_5: false,
header_info_category_5: null,
header_info_name_5: null,
};
@@ -112,8 +100,6 @@ function ListRow({
if (firstLoopComponentName) {
secondHeaderObject = {
header_label_2: firstLoopComponentName,
- header_icon_name_2: 'component',
- header_icon_isCustom_2: false,
header_info_category_2: firstComponentCategory,
header_info_name_2: firstLoopComponentName,
};
@@ -121,7 +107,6 @@ function ListRow({
thirdHeaderObject = {
...thirdHeaderObject,
header_label_3: name,
- header_icon_name_3: null,
};
}
@@ -129,27 +114,22 @@ function ListRow({
thirdHeaderObject = {
...thirdHeaderObject,
header_label_3: secondLoopComponentName,
- header_icon_name_3: 'component',
header_info_category_3: secondComponentCategory,
header_info_name_3: secondLoopComponentName,
};
fourthHeaderObject = {
...fourthHeaderObject,
header_label_4: name,
- header_icon_name_4: null,
};
}
if (isFromDynamicZone || isNestedInDZComponent) {
secondHeaderObject = {
header_label_2: dzName,
- header_icon_name_2: 'dynamiczone',
- header_icon_isCustom_2: false,
header_info_name_2: null,
header_info_category_2: null,
};
thirdHeaderObject = {
- header_icon_name_3: 'component',
header_label_3: firstLoopComponentName,
header_info_name_3: firstComponentCategory,
header_info_category_3: firstComponentCategory,
@@ -157,15 +137,11 @@ function ListRow({
if (!isNestedInDZComponent) {
fourthHeaderObject = {
- header_icon_name_4: null,
- header_icon_isCustom_4: false,
header_info_category_4: null,
header_label_4: name,
};
} else {
fourthHeaderObject = {
- header_icon_name_4: 'components',
- header_icon_isCustom_4: false,
header_info_category_4: secondComponentCategory,
header_info_name_4: secondLoopComponentName,
header_label_4: secondLoopComponentName,
diff --git a/packages/core/content-type-builder/admin/src/pages/ListView/index.js b/packages/core/content-type-builder/admin/src/pages/ListView/index.js
index 640b5e7aed..d2774536d7 100644
--- a/packages/core/content-type-builder/admin/src/pages/ListView/index.js
+++ b/packages/core/content-type-builder/admin/src/pages/ListView/index.js
@@ -100,8 +100,6 @@ const ListView = () => {
const handleClickAddComponentToDZ = async dzName => {
const firstHeaderObject = {
header_label_1: currentDataName,
- header_icon_name_1: 'dynamiczone',
- header_icon_isCustom_1: false,
};
const secondHeaderObj = {
header_label_2: dzName,
@@ -217,8 +215,6 @@ const ListView = () => {
forTarget: firstMainDataPath,
targetUid,
header_label_1: label,
- header_icon_isCustom_1: false,
- header_icon_name_1: contentType === 'singleType' ? contentType : firstMainDataPath,
headerId: getTrad('modalForm.header-edit'),
}),
});
@@ -245,9 +241,6 @@ const ListView = () => {
onClick={() => {
const headerDisplayObject = {
header_label_1: currentDataName,
- header_icon_name_1:
- forTarget === 'contentType' ? contentTypeKind : forTarget,
- header_icon_isCustom_1: false,
};
handleClickAddField(forTarget, targetUid, headerDisplayObject);
}}