mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Fix ModalHeader title
This commit is contained in:
parent
4c840e07ff
commit
cd6c2c5c36
@ -105,6 +105,7 @@ const DataManagerProvider = ({ children }) => {
|
||||
contentTypes,
|
||||
createSchema,
|
||||
initialData,
|
||||
isInContentTypeView,
|
||||
modifiedData,
|
||||
setModifiedData,
|
||||
}}
|
||||
|
||||
@ -244,7 +244,8 @@ const FormModal = () => {
|
||||
>
|
||||
<HeaderModal>
|
||||
<ModalHeader
|
||||
name={state.forTarget || name}
|
||||
// name={state.forTarget || name}
|
||||
name={name}
|
||||
headerId={headerId}
|
||||
iconType={iconType || 'contentType'}
|
||||
/>
|
||||
@ -296,7 +297,7 @@ const FormModal = () => {
|
||||
<hr
|
||||
style={{
|
||||
width: 'calc(100% - 30px)',
|
||||
marginBottom: 7,
|
||||
marginBottom: 25,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { get } from 'lodash';
|
||||
import { ViewContainer } from 'strapi-helper-plugin';
|
||||
import useDataManager from '../../hooks/useDataManager';
|
||||
@ -7,7 +7,13 @@ import LeftMenu from '../LeftMenu';
|
||||
|
||||
const ListPage = () => {
|
||||
const { pathname } = useLocation();
|
||||
const { modifiedData, setModifiedData } = useDataManager();
|
||||
const {
|
||||
initialData,
|
||||
modifiedData,
|
||||
isInContentTypeView,
|
||||
setModifiedData,
|
||||
} = useDataManager();
|
||||
const { push } = useHistory();
|
||||
const setModifiedDataRef = useRef();
|
||||
setModifiedDataRef.current = setModifiedData;
|
||||
|
||||
@ -16,13 +22,25 @@ const ListPage = () => {
|
||||
}, [pathname]);
|
||||
|
||||
const attributes = get(modifiedData, ['schema', 'attributes'], {});
|
||||
|
||||
const handleClick = () => {
|
||||
const currentDataName = get(initialData, ['schema', 'name'], '');
|
||||
const forTarget = isInContentTypeView ? 'contentType' : 'component';
|
||||
const search = `modalType=chooseAttribute&forTarget=${forTarget}&targetr=${currentDataName}`;
|
||||
push({ search });
|
||||
};
|
||||
|
||||
console.log({ allSchema: modifiedData });
|
||||
|
||||
return (
|
||||
<ViewContainer>
|
||||
<div className="container-fluid">
|
||||
<div className="row">
|
||||
<LeftMenu />
|
||||
<div className="col-md-9">
|
||||
<button type="button" onClick={handleClick}>
|
||||
Add field
|
||||
</button>
|
||||
<ul>
|
||||
{Object.keys(attributes).map(attr => (
|
||||
<li key={attr}>{attr}</li>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user