mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 06:50:51 +00:00
Merge branch 'master' into feature/replace-virtualized-window
This commit is contained in:
commit
4631f9f87b
@ -12,10 +12,12 @@ import isEmpty from 'lodash/isEmpty';
|
|||||||
import { getTrad } from '../../utils';
|
import { getTrad } from '../../utils';
|
||||||
|
|
||||||
const StyledBullet = styled.div`
|
const StyledBullet = styled.div`
|
||||||
|
flex-shrink: 0;
|
||||||
width: ${pxToRem(6)};
|
width: ${pxToRem(6)};
|
||||||
height: ${pxToRem(6)};
|
height: ${pxToRem(6)};
|
||||||
margin-right: ${({ theme }) => theme.spaces[2]};
|
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%;
|
border-radius: 50%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`;
|
`;
|
||||||
|
@ -5,7 +5,7 @@ import { Stack } from '@strapi/design-system/Stack';
|
|||||||
import { Typography } from '@strapi/design-system/Typography';
|
import { Typography } from '@strapi/design-system/Typography';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import isNull from 'lodash/isNull';
|
import isNull from 'lodash/isNull';
|
||||||
import Select from 'react-select';
|
import { ReactSelect as Select } from '@strapi/helper-plugin';
|
||||||
import SingleValue from './SingleValue';
|
import SingleValue from './SingleValue';
|
||||||
|
|
||||||
function SelectOne({
|
function SelectOne({
|
||||||
@ -21,7 +21,6 @@ function SelectOne({
|
|||||||
onMenuScrollToBottom,
|
onMenuScrollToBottom,
|
||||||
options,
|
options,
|
||||||
placeholder,
|
placeholder,
|
||||||
styles,
|
|
||||||
value,
|
value,
|
||||||
description,
|
description,
|
||||||
}) {
|
}) {
|
||||||
@ -48,7 +47,6 @@ function SelectOne({
|
|||||||
placeholder={formatMessage(
|
placeholder={formatMessage(
|
||||||
placeholder || { id: 'global.select', defaultMessage: 'Select...' }
|
placeholder || { id: 'global.select', defaultMessage: 'Select...' }
|
||||||
)}
|
)}
|
||||||
styles={styles}
|
|
||||||
value={isNull(value) ? null : { label: get(value, [mainField.name], ''), value }}
|
value={isNull(value) ? null : { label: get(value, [mainField.name], ''), value }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -89,7 +87,6 @@ SelectOne.propTypes = {
|
|||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
defaultMessage: PropTypes.string.isRequired,
|
defaultMessage: PropTypes.string.isRequired,
|
||||||
}),
|
}),
|
||||||
styles: PropTypes.object.isRequired,
|
|
||||||
value: PropTypes.object,
|
value: PropTypes.object,
|
||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
@ -10,10 +10,12 @@ import { pxToRem } from '@strapi/helper-plugin';
|
|||||||
import { getTrad } from '../../utils';
|
import { getTrad } from '../../utils';
|
||||||
|
|
||||||
const StyledBullet = styled.div`
|
const StyledBullet = styled.div`
|
||||||
|
flex-shrink: 0;
|
||||||
width: ${pxToRem(6)};
|
width: ${pxToRem(6)};
|
||||||
height: ${pxToRem(6)};
|
height: ${pxToRem(6)};
|
||||||
margin-right: ${({ theme }) => theme.spaces[2]};
|
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%;
|
border-radius: 50%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`;
|
`;
|
||||||
@ -22,29 +24,27 @@ const Option = props => {
|
|||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const Component = components.Option;
|
const Component = components.Option;
|
||||||
const hasDraftAndPublish = has(get(props, 'data.value'), 'publishedAt');
|
const hasDraftAndPublish = has(get(props, 'data.value'), 'publishedAt');
|
||||||
const isDraft = isEmpty(get(props, 'data.value.publishedAt'));
|
|
||||||
|
|
||||||
if (hasDraftAndPublish) {
|
if (hasDraftAndPublish) {
|
||||||
if (hasDraftAndPublish) {
|
const isDraft = isEmpty(get(props, 'data.value.publishedAt'));
|
||||||
const draftMessage = {
|
const draftMessage = {
|
||||||
id: getTrad('components.Select.draft-info-title'),
|
id: getTrad('components.Select.draft-info-title'),
|
||||||
defaultMessage: 'State: Draft',
|
defaultMessage: 'State: Draft',
|
||||||
};
|
};
|
||||||
const publishedMessage = {
|
const publishedMessage = {
|
||||||
id: getTrad('components.Select.publish-info-title'),
|
id: getTrad('components.Select.publish-info-title'),
|
||||||
defaultMessage: 'State: Published',
|
defaultMessage: 'State: Published',
|
||||||
};
|
};
|
||||||
const title = isDraft ? formatMessage(draftMessage) : formatMessage(publishedMessage);
|
const title = isDraft ? formatMessage(draftMessage) : formatMessage(publishedMessage);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component {...props}>
|
<Component {...props}>
|
||||||
<Flex>
|
<Flex>
|
||||||
<StyledBullet title={title} isDraft={isDraft} />
|
<StyledBullet title={title} isDraft={isDraft} />
|
||||||
<Typography ellipsis>{props.label || '-'}</Typography>
|
<Typography ellipsis>{props.label || '-'}</Typography>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Component>
|
</Component>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Component {...props}>{props.label || '-'}</Component>;
|
return <Component {...props}>{props.label || '-'}</Component>;
|
||||||
|
@ -119,7 +119,6 @@
|
|||||||
"react-refresh": "0.11.0",
|
"react-refresh": "0.11.0",
|
||||||
"react-router": "5.2.0",
|
"react-router": "5.2.0",
|
||||||
"react-router-dom": "5.2.0",
|
"react-router-dom": "5.2.0",
|
||||||
"react-select": "^4.0.2",
|
|
||||||
"react-window": "1.8.7",
|
"react-window": "1.8.7",
|
||||||
"redux": "^4.0.1",
|
"redux": "^4.0.1",
|
||||||
"redux-saga": "^0.16.0",
|
"redux-saga": "^0.16.0",
|
||||||
|
3
packages/plugins/graphql/server/bootstrap.js
vendored
3
packages/plugins/graphql/server/bootstrap.js
vendored
@ -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);
|
return strapi.auth.authenticate(ctx, next);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user