diff --git a/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/Wrapper.js b/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/Wrapper.js deleted file mode 100644 index b16441fb9c..0000000000 --- a/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/Wrapper.js +++ /dev/null @@ -1,12 +0,0 @@ -import styled from 'styled-components'; - -const Wrapper = styled.div` - display: flex; - height: 36px; - border-radius: ${({ theme }) => theme.main.sizes.borderRadius}; - margin-bottom: 18px; - background-color: ${({ theme, isGrey }) => - isGrey ? theme.main.colors.content.background : theme.main.colors.white}; -`; - -export default Wrapper; diff --git a/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/index.js b/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/index.js index bd80e4fb94..c630abf8bc 100644 --- a/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/index.js +++ b/packages/core/admin/admin/src/components/Roles/ConditionsModal/ActionRow/index.js @@ -1,10 +1,14 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Text, Padded, Flex } from '@buffetjs/core'; +import { Row, TableLabel } from '@strapi/parts'; import { useIntl } from 'react-intl'; +import styled from 'styled-components'; import ConditionsSelect from '../ConditionsSelect'; -import Wrapper from './Wrapper'; + +const RowWrapper = styled(Row)` + height: 52px; +`; const ActionRow = ({ arrayOfOptionsGroupedByCategory, @@ -19,50 +23,27 @@ const ActionRow = ({ const { formatMessage } = useIntl(); return ( - - - - - {formatMessage({ - id: 'Settings.permissions.conditions.can', - })} -   - - - {formatMessage({ - id: `Settings.roles.form.permissions.${label.toLowerCase()}`, - defaultMessage: label, - })} - - -   - {formatMessage({ - id: 'Settings.permissions.conditions.when', - })} - - - + + + + {formatMessage({ + id: 'Settings.permissions.conditions.can', + })} +   + + + {formatMessage({ + id: `Settings.roles.form.permissions.${label.toLowerCase()}`, + defaultMessage: label, + })} + + +   + {formatMessage({ + id: 'Settings.permissions.conditions.when', + })} + + - + ); }; diff --git a/packages/core/admin/admin/src/components/Roles/ConditionsModal/Separator.js b/packages/core/admin/admin/src/components/Roles/ConditionsModal/Separator.js deleted file mode 100644 index 5ac1963d5c..0000000000 --- a/packages/core/admin/admin/src/components/Roles/ConditionsModal/Separator.js +++ /dev/null @@ -1,9 +0,0 @@ -import styled from 'styled-components'; - -const Separator = styled.div` - padding-top: 1.4rem; - margin-bottom: 2.8rem; - border-bottom: 1px solid ${({ theme }) => theme.main.colors.brightGrey}; -`; - -export default Separator; diff --git a/packages/core/admin/admin/src/components/Roles/ConditionsModal/index.js b/packages/core/admin/admin/src/components/Roles/ConditionsModal/index.js index 5e1c66b631..b5d383535c 100644 --- a/packages/core/admin/admin/src/components/Roles/ConditionsModal/index.js +++ b/packages/core/admin/admin/src/components/Roles/ConditionsModal/index.js @@ -1,14 +1,38 @@ -import React, { useMemo, useState } from 'react'; +import { After } from '@strapi/icons'; +import { + Box, + Button, + H2, + ModalFooter, + ModalHeader, + ModalLayout, + Stack, + Text, + TextButton, +} from '@strapi/parts'; +import { cloneDeep, get, groupBy, set, upperFirst } from 'lodash'; import PropTypes from 'prop-types'; -import { cloneDeep, get, groupBy, set } from 'lodash'; -import { Modal, ModalHeader, ModalFooter } from '@strapi/helper-plugin'; -import { Button, Text, Padded } from '@buffetjs/core'; -import { useIntl } from 'react-intl'; +import React, { useMemo, useState } from 'react'; +import { FormattedMessage, useIntl } from 'react-intl'; +import styled from 'styled-components'; import { usePermissionsDataManager } from '../../../hooks'; -import createDefaultConditionsForm from './utils/createDefaultConditionsForm'; -import ActionRow from './ActionRow'; -import Separator from './Separator'; import updateValues from '../Permissions/utils/updateValues'; +import ActionRow from './ActionRow'; +import createDefaultConditionsForm from './utils/createDefaultConditionsForm'; + +// ! Something needs to be done in the DS parts to avoid doing this +const Icon = styled(Box)` + svg { + width: 6px; + } + * { + fill: ${({ theme }) => theme.colors.neutral300}; + } +`; + +const Separator = styled.div` + border-bottom: 1px solid ${({ theme }) => theme.main.colors.brightGrey}; +`; const ConditionsModal = ({ actions, @@ -21,6 +45,11 @@ const ConditionsModal = ({ const { formatMessage } = useIntl(); const { availableConditions, modifiedData, onChangeConditions } = usePermissionsDataManager(); + const translatedHeaders = headerBreadCrumbs.map(headerTrad => ({ + key: headerTrad, + element: , + })); + const arrayOfOptionsGroupedByCategory = useMemo(() => { return Object.entries(groupBy(availableConditions, 'category')); }, [availableConditions]); @@ -79,53 +108,77 @@ const ConditionsModal = ({ onToggle(); }; - return ( - - - - - {formatMessage({ - id: 'Settings.permissions.conditions.define-conditions', - })} - - - {actionsToDisplay.length === 0 && ( - - {formatMessage({ id: 'Settings.permissions.conditions.no-actions' })} - - )} - {actionsToDisplay.map(({ actionId, label, pathToConditionsObject }, index) => { - const name = pathToConditionsObject.join('..'); + if (!isOpen) return null; - return ( - - ); - })} - - -
- - - -
-
-
+ } + /> + ); }; diff --git a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js index a31f0b0605..75a45e8d75 100644 --- a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +++ b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js @@ -64,8 +64,8 @@ const Chevron = styled(Box)` const TinyDot = styled(Box)` position: absolute; - top: 0; - left: 35px; + top: -6px; + left: 37px; width: 6px; height: 6px; border-radius: 20px; diff --git a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js index bd75f78cac..92f730f2a4 100644 --- a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js +++ b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/CollapsePropertyMatrix/ActionRow/index.js @@ -23,6 +23,7 @@ const Cell = styled(Box)` position: relative; `; +// ! Something needs to be done in the DS parts to avoid doing this const Chevron = styled(Box)` display: none; svg {