mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge pull request #17062 from nitinmadelyn/ui-improvement
This commit is contained in:
commit
47c5ea3c12
@ -95,6 +95,7 @@ const FormModal = () => {
|
|||||||
forTarget,
|
forTarget,
|
||||||
modalType,
|
modalType,
|
||||||
isOpen,
|
isOpen,
|
||||||
|
showBackLink,
|
||||||
kind,
|
kind,
|
||||||
step,
|
step,
|
||||||
targetUid,
|
targetUid,
|
||||||
@ -1006,6 +1007,7 @@ const FormModal = () => {
|
|||||||
targetUid={targetUid}
|
targetUid={targetUid}
|
||||||
attributeType={attributeType}
|
attributeType={attributeType}
|
||||||
customFieldUid={customFieldUid}
|
customFieldUid={customFieldUid}
|
||||||
|
showBackLink={showBackLink}
|
||||||
/>
|
/>
|
||||||
{isPickingAttribute && (
|
{isPickingAttribute && (
|
||||||
<AttributeOptions
|
<AttributeOptions
|
||||||
|
@ -8,11 +8,14 @@ import React from 'react';
|
|||||||
|
|
||||||
import { Box, Flex, ModalHeader, Typography } from '@strapi/design-system';
|
import { Box, Flex, ModalHeader, Typography } from '@strapi/design-system';
|
||||||
import { Breadcrumbs, Crumb } from '@strapi/design-system/v2';
|
import { Breadcrumbs, Crumb } from '@strapi/design-system/v2';
|
||||||
|
import { Link } from '@strapi/helper-plugin';
|
||||||
|
import { ArrowLeft } from '@strapi/icons';
|
||||||
import upperFirst from 'lodash/upperFirst';
|
import upperFirst from 'lodash/upperFirst';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
|
|
||||||
import useDataManager from '../../hooks/useDataManager';
|
import useDataManager from '../../hooks/useDataManager';
|
||||||
|
import useFormModalNavigation from '../../hooks/useFormModalNavigation';
|
||||||
import getTrad from '../../utils/getTrad';
|
import getTrad from '../../utils/getTrad';
|
||||||
import AttributeIcon from '../AttributeIcon';
|
import AttributeIcon from '../AttributeIcon';
|
||||||
|
|
||||||
@ -27,9 +30,11 @@ const FormModalHeader = ({
|
|||||||
modalType,
|
modalType,
|
||||||
targetUid,
|
targetUid,
|
||||||
customFieldUid,
|
customFieldUid,
|
||||||
|
showBackLink
|
||||||
}) => {
|
}) => {
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const { modifiedData } = useDataManager();
|
const { modifiedData } = useDataManager();
|
||||||
|
const { onOpenModalAddField } = useFormModalNavigation();
|
||||||
|
|
||||||
let icon;
|
let icon;
|
||||||
let headers = [];
|
let headers = [];
|
||||||
@ -107,6 +112,7 @@ const FormModalHeader = ({
|
|||||||
return (
|
return (
|
||||||
<ModalHeader>
|
<ModalHeader>
|
||||||
<Flex gap={3}>
|
<Flex gap={3}>
|
||||||
|
{showBackLink && (<Link aria-label="Back" startIcon={<ArrowLeft />} onClick={() => onOpenModalAddField({ forTarget, targetUid })} to="#back" />)}
|
||||||
<AttributeIcon type={icon} customField={customFieldUid} />
|
<AttributeIcon type={icon} customField={customFieldUid} />
|
||||||
|
|
||||||
<Breadcrumbs label={headers.map(({ label }) => label).join(',')}>
|
<Breadcrumbs label={headers.map(({ label }) => label).join(',')}>
|
||||||
@ -145,6 +151,7 @@ FormModalHeader.defaultProps = {
|
|||||||
contentTypeKind: null,
|
contentTypeKind: null,
|
||||||
targetUid: null,
|
targetUid: null,
|
||||||
customFieldUid: null,
|
customFieldUid: null,
|
||||||
|
showBackLink: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
FormModalHeader.propTypes = {
|
FormModalHeader.propTypes = {
|
||||||
@ -158,6 +165,7 @@ FormModalHeader.propTypes = {
|
|||||||
modalType: PropTypes.string.isRequired,
|
modalType: PropTypes.string.isRequired,
|
||||||
targetUid: PropTypes.string,
|
targetUid: PropTypes.string,
|
||||||
customFieldUid: PropTypes.string,
|
customFieldUid: PropTypes.string,
|
||||||
|
showBackLink: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FormModalHeader;
|
export default FormModalHeader;
|
||||||
|
@ -7,6 +7,7 @@ const INITIAL_STATE_DATA = {
|
|||||||
forTarget: null,
|
forTarget: null,
|
||||||
modalType: null,
|
modalType: null,
|
||||||
isOpen: false,
|
isOpen: false,
|
||||||
|
showBackLink: false,
|
||||||
kind: null,
|
kind: null,
|
||||||
step: null,
|
step: null,
|
||||||
targetUid: null,
|
targetUid: null,
|
||||||
|
@ -36,6 +36,7 @@ const FormModalNavigationProvider = ({ children }) => {
|
|||||||
modalType: 'attribute',
|
modalType: 'attribute',
|
||||||
step,
|
step,
|
||||||
attributeType,
|
attributeType,
|
||||||
|
showBackLink: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -64,6 +65,7 @@ const FormModalNavigationProvider = ({ children }) => {
|
|||||||
targetUid,
|
targetUid,
|
||||||
modalType: 'chooseAttribute',
|
modalType: 'chooseAttribute',
|
||||||
isOpen: true,
|
isOpen: true,
|
||||||
|
showBackLink: false,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -109,7 +109,7 @@ const ListView = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Prompt
|
<Prompt
|
||||||
message={formatMessage({ id: getTrad('prompt.unsaved') })}
|
message={(location) => location.hash === '#back' ? false : formatMessage({ id: getTrad('prompt.unsaved') })}
|
||||||
when={hasModelBeenModified}
|
when={hasModelBeenModified}
|
||||||
/>
|
/>
|
||||||
<HeaderLayout
|
<HeaderLayout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user