Merge branch 'master' into feature/replace-virtualized-window

This commit is contained in:
Gustav Hansen 2022-07-29 12:11:04 +02:00 committed by GitHub
commit 4631f9f87b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 27 deletions

View File

@ -12,10 +12,12 @@ import isEmpty from 'lodash/isEmpty';
import { getTrad } from '../../utils';
const StyledBullet = styled.div`
flex-shrink: 0;
width: ${pxToRem(6)};
height: ${pxToRem(6)};
margin-right: ${({ theme }) => theme.spaces[2]};
background: ${({ theme, isDraft }) => theme.colors[isDraft ? 'secondary700' : 'success200']};
background-color: ${({ theme, isDraft }) =>
theme.colors[isDraft ? 'secondary600' : 'success600']};
border-radius: 50%;
cursor: pointer;
`;

View File

@ -5,7 +5,7 @@ import { Stack } from '@strapi/design-system/Stack';
import { Typography } from '@strapi/design-system/Typography';
import get from 'lodash/get';
import isNull from 'lodash/isNull';
import Select from 'react-select';
import { ReactSelect as Select } from '@strapi/helper-plugin';
import SingleValue from './SingleValue';
function SelectOne({
@ -21,7 +21,6 @@ function SelectOne({
onMenuScrollToBottom,
options,
placeholder,
styles,
value,
description,
}) {
@ -48,7 +47,6 @@ function SelectOne({
placeholder={formatMessage(
placeholder || { id: 'global.select', defaultMessage: 'Select...' }
)}
styles={styles}
value={isNull(value) ? null : { label: get(value, [mainField.name], ''), value }}
/>
@ -89,7 +87,6 @@ SelectOne.propTypes = {
id: PropTypes.string.isRequired,
defaultMessage: PropTypes.string.isRequired,
}),
styles: PropTypes.object.isRequired,
value: PropTypes.object,
description: PropTypes.string,
};

View File

@ -10,10 +10,12 @@ import { pxToRem } from '@strapi/helper-plugin';
import { getTrad } from '../../utils';
const StyledBullet = styled.div`
flex-shrink: 0;
width: ${pxToRem(6)};
height: ${pxToRem(6)};
margin-right: ${({ theme }) => theme.spaces[2]};
background: ${({ theme, isDraft }) => theme.colors[isDraft ? 'secondary600' : 'success600']};
background-color: ${({ theme, isDraft }) =>
theme.colors[isDraft ? 'secondary600' : 'success600']};
border-radius: 50%;
cursor: pointer;
`;
@ -22,29 +24,27 @@ const Option = props => {
const { formatMessage } = useIntl();
const Component = components.Option;
const hasDraftAndPublish = has(get(props, 'data.value'), 'publishedAt');
const isDraft = isEmpty(get(props, 'data.value.publishedAt'));
if (hasDraftAndPublish) {
if (hasDraftAndPublish) {
const draftMessage = {
id: getTrad('components.Select.draft-info-title'),
defaultMessage: 'State: Draft',
};
const publishedMessage = {
id: getTrad('components.Select.publish-info-title'),
defaultMessage: 'State: Published',
};
const title = isDraft ? formatMessage(draftMessage) : formatMessage(publishedMessage);
const isDraft = isEmpty(get(props, 'data.value.publishedAt'));
const draftMessage = {
id: getTrad('components.Select.draft-info-title'),
defaultMessage: 'State: Draft',
};
const publishedMessage = {
id: getTrad('components.Select.publish-info-title'),
defaultMessage: 'State: Published',
};
const title = isDraft ? formatMessage(draftMessage) : formatMessage(publishedMessage);
return (
<Component {...props}>
<Flex>
<StyledBullet title={title} isDraft={isDraft} />
<Typography ellipsis>{props.label || '-'}</Typography>
</Flex>
</Component>
);
}
return (
<Component {...props}>
<Flex>
<StyledBullet title={title} isDraft={isDraft} />
<Typography ellipsis>{props.label || '-'}</Typography>
</Flex>
</Component>
);
}
return <Component {...props}>{props.label || '-'}</Component>;

View File

@ -119,7 +119,6 @@
"react-refresh": "0.11.0",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
"react-select": "^4.0.2",
"react-window": "1.8.7",
"redux": "^4.0.1",
"redux-saga": "^0.16.0",

View File

@ -110,6 +110,9 @@ module.exports = async ({ strapi }) => {
},
};
// allow graphql playground to load without authentication
if (ctx.request.method === 'GET') return next();
return strapi.auth.authenticate(ctx, next);
},