mirror of
https://github.com/strapi/strapi.git
synced 2025-11-23 13:40:58 +00:00
Add routing for adding attributes to created compo, not working when creating a sub one on the fly
This commit is contained in:
parent
13bb647da8
commit
cc88f62a29
@ -8,6 +8,7 @@ const ComponentInfos = ({ uid }) => {
|
|||||||
// We might want to change to initialData...
|
// We might want to change to initialData...
|
||||||
// @Aurelsicoko
|
// @Aurelsicoko
|
||||||
const { modifiedData } = useDataManager();
|
const { modifiedData } = useDataManager();
|
||||||
|
console.log({ modifiedData });
|
||||||
const currentComponent = get(modifiedData, ['components', uid], {});
|
const currentComponent = get(modifiedData, ['components', uid], {});
|
||||||
const currentComponentCategory = get(currentComponent, 'category', '');
|
const currentComponentCategory = get(currentComponent, 'category', '');
|
||||||
const currentComponentFriendlyName = get(
|
const currentComponentFriendlyName = get(
|
||||||
@ -15,6 +16,7 @@ const ComponentInfos = ({ uid }) => {
|
|||||||
['schema', 'name'],
|
['schema', 'name'],
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
console.log({ uid, currentComponentFriendlyName });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ComponentInfosWrapper>
|
<ComponentInfosWrapper>
|
||||||
|
|||||||
@ -398,6 +398,7 @@ const FormModal = () => {
|
|||||||
|
|
||||||
// Add/edit a field
|
// Add/edit a field
|
||||||
} else if (isCreatingAttribute && !isCreatingComponentFromAView) {
|
} else if (isCreatingAttribute && !isCreatingComponentFromAView) {
|
||||||
|
console.log('not creat compo');
|
||||||
// Normal fields like boolean relations or dynamic zone
|
// Normal fields like boolean relations or dynamic zone
|
||||||
if (!isComponentAttribute) {
|
if (!isComponentAttribute) {
|
||||||
addAttribute(
|
addAttribute(
|
||||||
@ -408,7 +409,6 @@ const FormModal = () => {
|
|||||||
initialData
|
initialData
|
||||||
);
|
);
|
||||||
const isDynamicZoneAttribute = state.attributeType === 'dynamiczone';
|
const isDynamicZoneAttribute = state.attributeType === 'dynamiczone';
|
||||||
console.log('oooo');
|
|
||||||
// Adding a component to a dynamiczone is not the same logic as creating a simple field
|
// Adding a component to a dynamiczone is not the same logic as creating a simple field
|
||||||
// so the search is different
|
// so the search is different
|
||||||
// TODO make sure it works for edit
|
// TODO make sure it works for edit
|
||||||
@ -530,7 +530,13 @@ const FormModal = () => {
|
|||||||
|
|
||||||
// TODO temporary
|
// TODO temporary
|
||||||
dispatch({ type: 'RESET_PROPS' });
|
dispatch({ type: 'RESET_PROPS' });
|
||||||
push({ search: '' });
|
|
||||||
|
// Open modal attribute for adding attr to component
|
||||||
|
// The we inverse the headerDisplayName because it becomes the last one displayed
|
||||||
|
const searchToOpenModalAttributeToAddAttributesToAComponent = `modalType=chooseAttribute&forTarget=components&targetUid=${componentUid}&headerDisplayName=${componentToCreate.name}&headerDisplayCategory=${state.headerDisplayName}`;
|
||||||
|
push({
|
||||||
|
search: searchToOpenModalAttributeToAddAttributesToAComponent,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// The modal is addComponentToDynamicZone
|
// The modal is addComponentToDynamicZone
|
||||||
@ -625,6 +631,8 @@ const FormModal = () => {
|
|||||||
nestedComponents
|
nestedComponents
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log({ state });
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
const modalBodyStyle = isPickingAttribute
|
const modalBodyStyle = isPickingAttribute
|
||||||
? { paddingTop: '0.5rem', paddingBottom: '3rem' }
|
? { paddingTop: '0.5rem', paddingBottom: '3rem' }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user