@strapi/admin 4.1.10-beta.0 → 4.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/assets/images/homepage-logo.png +0 -0
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +2 -6
- package/admin/src/components/GuidedTour/Homepage/index.js +1 -2
- package/admin/src/components/GuidedTour/Modal/components/Stepper.js +1 -2
- package/admin/src/components/LeftMenu/index.js +9 -9
- package/admin/src/components/Notifications/Notification/index.js +2 -2
- package/admin/src/components/Providers/index.js +4 -8
- package/admin/src/components/UnauthenticatedLogo/index.js +2 -4
- package/admin/src/components/UpgradePlanModal/index.js +6 -2
- package/admin/src/content-manager/components/SelectMany/ListItem.js +1 -2
- package/admin/src/content-manager/components/SelectWrapper/index.js +8 -7
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +2 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +2 -0
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +8 -7
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/LinkToCTB.js +1 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/EditView/Header/index.js +3 -3
- package/admin/src/content-manager/pages/EditView/index.js +1 -4
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/ListView/index.js +1 -1
- package/admin/src/content-manager/pages/NoContentType/index.js +1 -2
- package/admin/src/pages/App/index.js +2 -7
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +1 -2
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -2
- package/admin/src/pages/AuthPage/components/Oops/index.js +1 -2
- package/admin/src/pages/AuthPage/components/Register/index.js +12 -12
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +3 -4
- package/admin/src/pages/HomePage/HomeHeader.js +2 -2
- package/admin/src/pages/HomePage/SocialLinks.js +4 -3
- package/admin/src/pages/InternalErrorPage/index.js +1 -2
- package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +2 -1
- package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +4 -3
- package/admin/src/pages/NotFoundPage/index.js +1 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +5 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +94 -150
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
- package/admin/src/translations/ca.json +699 -0
- package/admin/src/translations/en.json +0 -25
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/ru.json +34 -0
- package/build/2077.51485bfb.chunk.js +194 -0
- package/build/6706.7f57cb76.chunk.js +113 -0
- package/build/7589.95466f9a.chunk.js +194 -0
- package/build/{5289.0341db2d.chunk.js → 7757.6d20cfe0.chunk.js} +89 -87
- package/build/8681.96961454.chunk.js +163 -0
- package/build/9066.118ecccd.chunk.js +101 -0
- package/build/9115.abdf4e3b.chunk.js +1 -0
- package/build/9158.60fcd720.chunk.js +503 -0
- package/build/{9298.f97fcef0.chunk.js → 9298.5b5c6ea1.chunk.js} +2 -2
- package/build/9420.cb0b75e8.chunk.js +508 -0
- package/build/Admin-authenticatedApp.ec0f0834.chunk.js +80 -0
- package/build/Admin_homePage.e6d4d977.chunk.js +71 -0
- package/build/Admin_marketplace.25133b64.chunk.js +11 -0
- package/build/Admin_settingsPage.e1dfbb1d.chunk.js +172 -0
- package/build/admin-edit-roles-page.e77a2acc.chunk.js +1 -0
- package/build/admin-edit-users.4c49fe98.chunk.js +11 -0
- package/build/api-tokens-create-page.618b3e40.chunk.js +1 -0
- package/build/api-tokens-edit-page.8d19dfe1.chunk.js +1 -0
- package/build/api-tokens-list-page.274e1c80.chunk.js +15 -0
- package/build/ca-json.0097e443.chunk.js +1 -0
- package/build/content-manager.d6449678.chunk.js +1204 -0
- package/build/{content-type-builder.0d8729ad.chunk.js → content-type-builder.a9554707.chunk.js} +8 -8
- package/build/en-json.3e1a222e.chunk.js +1 -0
- package/build/fb376b132d18bf4522ca.png +0 -0
- package/build/index.html +1 -1
- package/build/main.6dad6108.js +8404 -0
- package/build/ru-json.28147733.chunk.js +1 -0
- package/build/runtime~main.26528011.js +2 -0
- package/build/users-roles-settings-page.28bf6bdc.chunk.js +30 -0
- package/build/{webhook-edit-page.2e6727ab.chunk.js → webhook-edit-page.ca670f8d.chunk.js} +3 -3
- package/build/webhook-list-page.ce1fa92f.chunk.js +133 -0
- package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/package.json +5 -5
- package/server/config/admin-actions.js +0 -14
- package/server/controllers/admin.js +1 -33
- package/server/routes/admin.js +0 -28
- package/server/services/index.js +0 -1
- package/server/services/permission/permissions-manager/sanitize.js +22 -0
- package/server/services/user.js +1 -1
- package/server/utils/index.d.ts +0 -2
- package/admin/src/components/ConfigurationsProvider/index.js +0 -51
- package/admin/src/components/ConfigurationsProvider/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +0 -13
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +0 -43
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +0 -116
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +0 -25
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +0 -67
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +0 -176
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +0 -82
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +0 -51
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +0 -97
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -16
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +0 -76
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +0 -21
- package/build/2481.7ba28142.chunk.js +0 -184
- package/build/2a9e9ef5c4c775bb7c7b.png +0 -0
- package/build/372.3720845e.chunk.js +0 -899
- package/build/497.fbd75558.chunk.js +0 -284
- package/build/6404.80bf5858.chunk.js +0 -506
- package/build/7197.959bbe97.chunk.js +0 -113
- package/build/7589.f3b26345.chunk.js +0 -194
- package/build/9115.318a6841.chunk.js +0 -1
- package/build/9853.d96fbc67.chunk.js +0 -356
- package/build/Admin-authenticatedApp.d8767873.chunk.js +0 -80
- package/build/Admin_homePage.50b6c129.chunk.js +0 -71
- package/build/Admin_marketplace.514ace37.chunk.js +0 -11
- package/build/Admin_settingsPage.0d94a598.chunk.js +0 -180
- package/build/admin-edit-roles-page.06f3d288.chunk.js +0 -1
- package/build/admin-edit-users.6a325cca.chunk.js +0 -11
- package/build/api-tokens-create-page.635e20c8.chunk.js +0 -1
- package/build/api-tokens-edit-page.db07253e.chunk.js +0 -1
- package/build/api-tokens-list-page.346c2149.chunk.js +0 -15
- package/build/content-manager.78e3f35c.chunk.js +0 -1204
- package/build/en-json.ca572384.chunk.js +0 -1
- package/build/main.06f66609.js +0 -7909
- package/build/ru-json.4560906c.chunk.js +0 -1
- package/build/runtime~main.dc1c7ef6.js +0 -2
- package/build/users-roles-settings-page.97d7092d.chunk.js +0 -30
- package/build/webhook-list-page.927257b5.chunk.js +0 -133
- package/server/services/project-settings.js +0 -173
- package/server/validation/project-settings.js +0 -39
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, { useReducer } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { CarouselInput, CarouselSlide, CarouselActions } from '@strapi/design-system/CarouselInput';
|
|
5
|
-
import { IconButton } from '@strapi/design-system/IconButton';
|
|
6
|
-
import { Box } from '@strapi/design-system/Box';
|
|
7
|
-
import Plus from '@strapi/icons/Plus';
|
|
8
|
-
import Refresh from '@strapi/icons/Refresh';
|
|
9
|
-
import reducer, { initialState } from './reducer';
|
|
10
|
-
import LogoModalStepper from '../LogoModalStepper';
|
|
11
|
-
import { SIZE, DIMENSION } from '../../utils/constants';
|
|
12
|
-
import stepper from './stepper';
|
|
13
|
-
|
|
14
|
-
const LogoInput = ({ customLogo, defaultLogo, onChangeLogo, onResetMenuLogo }) => {
|
|
15
|
-
const [{ currentStep }, dispatch] = useReducer(reducer, initialState);
|
|
16
|
-
const { Component, next, prev, modalTitle } = stepper[currentStep] || {};
|
|
17
|
-
const { formatMessage } = useIntl();
|
|
18
|
-
|
|
19
|
-
const goTo = to => {
|
|
20
|
-
dispatch({
|
|
21
|
-
type: 'GO_TO',
|
|
22
|
-
to,
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<CarouselInput
|
|
29
|
-
label={formatMessage({
|
|
30
|
-
id: 'Settings.application.customization.carousel.title',
|
|
31
|
-
defaultMessage: 'Logo',
|
|
32
|
-
})}
|
|
33
|
-
selectedSlide={0}
|
|
34
|
-
hint={formatMessage(
|
|
35
|
-
{
|
|
36
|
-
id: 'Settings.application.customization.carousel-hint',
|
|
37
|
-
defaultMessage:
|
|
38
|
-
'Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)',
|
|
39
|
-
},
|
|
40
|
-
{ size: SIZE, dimension: DIMENSION }
|
|
41
|
-
)}
|
|
42
|
-
previousLabel=""
|
|
43
|
-
nextLabel=""
|
|
44
|
-
onNext={() => {}}
|
|
45
|
-
onPrevious={() => {}}
|
|
46
|
-
secondaryLabel={customLogo?.name || 'logo.png'}
|
|
47
|
-
actions={
|
|
48
|
-
<CarouselActions>
|
|
49
|
-
<IconButton
|
|
50
|
-
onClick={() => goTo(customLogo ? 'pending' : 'upload')}
|
|
51
|
-
label={formatMessage({
|
|
52
|
-
id: 'Settings.application.customization.carousel.change-action',
|
|
53
|
-
defaultMessage: 'Change logo',
|
|
54
|
-
})}
|
|
55
|
-
icon={<Plus />}
|
|
56
|
-
/>
|
|
57
|
-
{customLogo && (
|
|
58
|
-
<IconButton
|
|
59
|
-
onClick={onResetMenuLogo}
|
|
60
|
-
label={formatMessage({
|
|
61
|
-
id: 'Settings.application.customization.carousel.reset-action',
|
|
62
|
-
defaultMessage: 'Reset logo',
|
|
63
|
-
})}
|
|
64
|
-
icon={<Refresh />}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
</CarouselActions>
|
|
68
|
-
}
|
|
69
|
-
>
|
|
70
|
-
<CarouselSlide
|
|
71
|
-
label={formatMessage({
|
|
72
|
-
id: 'Settings.application.customization.carousel-slide.label',
|
|
73
|
-
defaultMessage: 'Logo slide',
|
|
74
|
-
})}
|
|
75
|
-
>
|
|
76
|
-
<Box
|
|
77
|
-
maxHeight="40%"
|
|
78
|
-
maxWidth="40%"
|
|
79
|
-
as="img"
|
|
80
|
-
src={customLogo?.url || defaultLogo}
|
|
81
|
-
alt={formatMessage({
|
|
82
|
-
id: 'Settings.application.customization.carousel.title',
|
|
83
|
-
defaultMessage: 'Logo',
|
|
84
|
-
})}
|
|
85
|
-
/>
|
|
86
|
-
</CarouselSlide>
|
|
87
|
-
</CarouselInput>
|
|
88
|
-
<LogoModalStepper
|
|
89
|
-
Component={Component}
|
|
90
|
-
currentStep={currentStep}
|
|
91
|
-
onChangeLogo={onChangeLogo}
|
|
92
|
-
customLogo={customLogo}
|
|
93
|
-
goTo={goTo}
|
|
94
|
-
next={next}
|
|
95
|
-
prev={prev}
|
|
96
|
-
modalTitle={modalTitle}
|
|
97
|
-
/>
|
|
98
|
-
</>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
LogoInput.defaultProps = {
|
|
103
|
-
customLogo: null,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
LogoInput.propTypes = {
|
|
107
|
-
customLogo: PropTypes.shape({
|
|
108
|
-
url: PropTypes.string,
|
|
109
|
-
name: PropTypes.string,
|
|
110
|
-
}),
|
|
111
|
-
defaultLogo: PropTypes.string.isRequired,
|
|
112
|
-
onChangeLogo: PropTypes.func.isRequired,
|
|
113
|
-
onResetMenuLogo: PropTypes.func.isRequired,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export default LogoInput;
|
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* LogoInput reducer
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import produce from 'immer';
|
|
9
|
-
|
|
10
|
-
const initialState = {
|
|
11
|
-
currentStep: undefined,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const reducer = (state = initialState, action) =>
|
|
15
|
-
produce(state, draftState => {
|
|
16
|
-
switch (action.type) {
|
|
17
|
-
case 'GO_TO': {
|
|
18
|
-
draftState.currentStep = action.to;
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
default: {
|
|
22
|
-
return draftState;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export default reducer;
|
|
28
|
-
export { initialState };
|
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import AddLogoDialog from '../LogoModalStepper/AddLogoDialog';
|
|
2
|
-
import PendingLogoDialog from '../LogoModalStepper/PendingLogoDialog';
|
|
3
|
-
|
|
4
|
-
const stepper = {
|
|
5
|
-
upload: {
|
|
6
|
-
Component: AddLogoDialog,
|
|
7
|
-
modalTitle: {
|
|
8
|
-
id: 'Settings.application.customization.modal.upload',
|
|
9
|
-
defaultMessage: 'Upload logo',
|
|
10
|
-
},
|
|
11
|
-
next: 'pending',
|
|
12
|
-
prev: null,
|
|
13
|
-
},
|
|
14
|
-
pending: {
|
|
15
|
-
Component: PendingLogoDialog,
|
|
16
|
-
modalTitle: {
|
|
17
|
-
id: 'Settings.application.customization.modal.pending',
|
|
18
|
-
defaultMessage: 'Pending logo',
|
|
19
|
-
},
|
|
20
|
-
next: null,
|
|
21
|
-
prev: 'upload',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default stepper;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { Tabs, Tab, TabGroup, TabPanels, TabPanel } from '@strapi/design-system/Tabs';
|
|
5
|
-
import { Box } from '@strapi/design-system/Box';
|
|
6
|
-
import { Divider } from '@strapi/design-system/Divider';
|
|
7
|
-
import FromComputerForm from './FromComputerForm';
|
|
8
|
-
import FromUrlForm from './FromUrlForm';
|
|
9
|
-
|
|
10
|
-
const AddLogoDialog = ({ setLocalImage, goTo, next, onClose }) => {
|
|
11
|
-
const { formatMessage } = useIntl();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<TabGroup
|
|
15
|
-
label={formatMessage({
|
|
16
|
-
id: 'Settings.application.customization.modal.tab.label',
|
|
17
|
-
defaultMessage: 'How do you want to upload your assets?',
|
|
18
|
-
})}
|
|
19
|
-
variant="simple"
|
|
20
|
-
>
|
|
21
|
-
<Box paddingLeft={8} paddingRight={8}>
|
|
22
|
-
<Tabs>
|
|
23
|
-
<Tab>
|
|
24
|
-
{formatMessage({
|
|
25
|
-
id: 'Settings.application.customization.modal.upload.from-computer',
|
|
26
|
-
defaultMessage: 'From computer',
|
|
27
|
-
})}
|
|
28
|
-
</Tab>
|
|
29
|
-
<Tab>
|
|
30
|
-
{formatMessage({
|
|
31
|
-
id: 'Settings.application.customization.modal.upload.from-url',
|
|
32
|
-
defaultMessage: 'From url',
|
|
33
|
-
})}
|
|
34
|
-
</Tab>
|
|
35
|
-
</Tabs>
|
|
36
|
-
|
|
37
|
-
<Divider />
|
|
38
|
-
</Box>
|
|
39
|
-
<TabPanels>
|
|
40
|
-
<TabPanel>
|
|
41
|
-
<FromComputerForm
|
|
42
|
-
onClose={onClose}
|
|
43
|
-
setLocalImage={setLocalImage}
|
|
44
|
-
goTo={goTo}
|
|
45
|
-
next={next}
|
|
46
|
-
/>
|
|
47
|
-
</TabPanel>
|
|
48
|
-
<TabPanel>
|
|
49
|
-
<FromUrlForm onClose={onClose} setLocalImage={setLocalImage} goTo={goTo} next={next} />
|
|
50
|
-
</TabPanel>
|
|
51
|
-
</TabPanels>
|
|
52
|
-
</TabGroup>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
AddLogoDialog.defaultProps = {
|
|
57
|
-
next: null,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
AddLogoDialog.propTypes = {
|
|
61
|
-
goTo: PropTypes.func.isRequired,
|
|
62
|
-
next: PropTypes.string,
|
|
63
|
-
onClose: PropTypes.func.isRequired,
|
|
64
|
-
setLocalImage: PropTypes.func.isRequired,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default AddLogoDialog;
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { Box } from '@strapi/design-system/Box';
|
|
6
|
-
import { Stack } from '@strapi/design-system/Stack';
|
|
7
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
8
|
-
import { Icon } from '@strapi/design-system/Icon';
|
|
9
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
10
|
-
import { ModalFooter } from '@strapi/design-system/ModalLayout';
|
|
11
|
-
import { Button } from '@strapi/design-system/Button';
|
|
12
|
-
import { Field, FieldError, FieldInput } from '@strapi/design-system/Field';
|
|
13
|
-
import PicturePlus from '@strapi/icons/PicturePlus';
|
|
14
|
-
import { parseFileMetadatas } from '../../utils/parseFileMetadatas';
|
|
15
|
-
import { ACCEPTED_FORMAT, SIZE, DIMENSION } from '../../utils/constants';
|
|
16
|
-
|
|
17
|
-
const FileInput = styled(FieldInput)`
|
|
18
|
-
opacity: 0;
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
bottom: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
right: 0;
|
|
24
|
-
z-index: 1;
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
const FromComputerForm = ({ setLocalImage, goTo, next, onClose }) => {
|
|
28
|
-
const { formatMessage } = useIntl();
|
|
29
|
-
const [dragOver, setDragOver] = useState(false);
|
|
30
|
-
const [fileError, setFileError] = useState(undefined);
|
|
31
|
-
const inputRef = useRef(null);
|
|
32
|
-
|
|
33
|
-
const handleDragEnter = () => setDragOver(true);
|
|
34
|
-
const handleDragLeave = () => setDragOver(false);
|
|
35
|
-
|
|
36
|
-
const handleClick = e => {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
inputRef.current.click();
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const handleChange = async () => {
|
|
42
|
-
handleDragLeave();
|
|
43
|
-
const file = inputRef.current.files[0];
|
|
44
|
-
|
|
45
|
-
if (!file) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
const asset = await parseFileMetadatas(file);
|
|
51
|
-
setLocalImage(asset);
|
|
52
|
-
goTo(next);
|
|
53
|
-
} catch (err) {
|
|
54
|
-
if (err.displayMessage) {
|
|
55
|
-
setFileError(formatMessage(err.displayMessage, { size: SIZE, dimension: DIMENSION }));
|
|
56
|
-
inputRef.current.focus();
|
|
57
|
-
} else {
|
|
58
|
-
throw err;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const getBorderColor = () => {
|
|
64
|
-
if (dragOver) {
|
|
65
|
-
return 'primary500';
|
|
66
|
-
}
|
|
67
|
-
if (fileError) {
|
|
68
|
-
return 'danger600';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return 'neutral300';
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<form>
|
|
77
|
-
<Box paddingLeft={8} paddingRight={8} paddingTop={6} paddingBottom={6}>
|
|
78
|
-
<Field name="logo-upload" error={fileError}>
|
|
79
|
-
<label htmlFor="logo-upload">
|
|
80
|
-
<Stack spacing={2}>
|
|
81
|
-
<Flex
|
|
82
|
-
paddingTop={9}
|
|
83
|
-
paddingBottom={7}
|
|
84
|
-
hasRadius
|
|
85
|
-
justifyContent="center"
|
|
86
|
-
direction="column"
|
|
87
|
-
background={dragOver ? 'primary100' : 'neutral100'}
|
|
88
|
-
borderColor={getBorderColor()}
|
|
89
|
-
borderStyle="dashed"
|
|
90
|
-
borderWidth="1px"
|
|
91
|
-
position="relative"
|
|
92
|
-
onDragEnter={handleDragEnter}
|
|
93
|
-
onDragLeave={handleDragLeave}
|
|
94
|
-
>
|
|
95
|
-
<Icon
|
|
96
|
-
color="primary600"
|
|
97
|
-
width={`${60 / 16}rem`}
|
|
98
|
-
height={`${60 / 16}rem`}
|
|
99
|
-
as={PicturePlus}
|
|
100
|
-
aria-hidden
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<Box paddingTop={3} paddingBottom={5}>
|
|
104
|
-
<Typography variant="delta" as="span">
|
|
105
|
-
{formatMessage({
|
|
106
|
-
id: 'Settings.application.customization.modal.upload.drag-drop',
|
|
107
|
-
defaultMessage: 'Drag and Drop here or',
|
|
108
|
-
})}
|
|
109
|
-
</Typography>
|
|
110
|
-
</Box>
|
|
111
|
-
|
|
112
|
-
<FileInput
|
|
113
|
-
accept={ACCEPTED_FORMAT}
|
|
114
|
-
cursor="pointer"
|
|
115
|
-
as="input"
|
|
116
|
-
type="file"
|
|
117
|
-
name="files"
|
|
118
|
-
tabIndex={-1}
|
|
119
|
-
zIndex={1}
|
|
120
|
-
onChange={handleChange}
|
|
121
|
-
ref={inputRef}
|
|
122
|
-
id="logo-upload"
|
|
123
|
-
/>
|
|
124
|
-
|
|
125
|
-
<Button type="button" onClick={handleClick}>
|
|
126
|
-
{formatMessage({
|
|
127
|
-
id: 'Settings.application.customization.modal.upload.cta.browse',
|
|
128
|
-
defaultMessage: 'Browse files',
|
|
129
|
-
})}
|
|
130
|
-
</Button>
|
|
131
|
-
|
|
132
|
-
<Box paddingTop={6}>
|
|
133
|
-
<Typography variant="pi" textColor="neutral600">
|
|
134
|
-
{formatMessage(
|
|
135
|
-
{
|
|
136
|
-
id: 'Settings.application.customization.modal.upload.file-validation',
|
|
137
|
-
defaultMessage:
|
|
138
|
-
'Max dimension: {dimension}x{dimension}, Max size: {size}KB',
|
|
139
|
-
},
|
|
140
|
-
{ size: SIZE, dimension: DIMENSION }
|
|
141
|
-
)}
|
|
142
|
-
</Typography>
|
|
143
|
-
</Box>
|
|
144
|
-
</Flex>
|
|
145
|
-
<FieldError />
|
|
146
|
-
</Stack>
|
|
147
|
-
</label>
|
|
148
|
-
</Field>
|
|
149
|
-
</Box>
|
|
150
|
-
</form>
|
|
151
|
-
<ModalFooter
|
|
152
|
-
startActions={
|
|
153
|
-
<Button onClick={onClose} variant="tertiary">
|
|
154
|
-
{formatMessage({
|
|
155
|
-
id: 'Settings.application.customization.modal.cancel',
|
|
156
|
-
defaultMessage: 'Cancel',
|
|
157
|
-
})}
|
|
158
|
-
</Button>
|
|
159
|
-
}
|
|
160
|
-
/>
|
|
161
|
-
</>
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
FromComputerForm.defaultProps = {
|
|
166
|
-
next: null,
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
FromComputerForm.propTypes = {
|
|
170
|
-
goTo: PropTypes.func.isRequired,
|
|
171
|
-
next: PropTypes.string,
|
|
172
|
-
onClose: PropTypes.func.isRequired,
|
|
173
|
-
setLocalImage: PropTypes.func.isRequired,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export default FromComputerForm;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { Box } from '@strapi/design-system/Box';
|
|
5
|
-
import { Button } from '@strapi/design-system/Button';
|
|
6
|
-
import { TextInput } from '@strapi/design-system/TextInput';
|
|
7
|
-
import { ModalFooter } from '@strapi/design-system/ModalLayout';
|
|
8
|
-
import urlToFile from '../../utils/urlToFile';
|
|
9
|
-
import { parseFileMetadatas } from '../../utils/parseFileMetadatas';
|
|
10
|
-
import { SIZE, DIMENSION } from '../../utils/constants';
|
|
11
|
-
|
|
12
|
-
const FromUrlForm = ({ goTo, next, onClose, setLocalImage }) => {
|
|
13
|
-
const { formatMessage } = useIntl();
|
|
14
|
-
const [logoUrl, setLogoUrl] = useState('');
|
|
15
|
-
const [error, setError] = useState(null);
|
|
16
|
-
|
|
17
|
-
const handleChange = e => {
|
|
18
|
-
setLogoUrl(e.target.value);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const handleSubmit = async e => {
|
|
22
|
-
e.preventDefault();
|
|
23
|
-
try {
|
|
24
|
-
const file = await urlToFile(logoUrl);
|
|
25
|
-
const asset = await parseFileMetadatas(file);
|
|
26
|
-
|
|
27
|
-
setLocalImage(asset);
|
|
28
|
-
goTo(next);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
if (err.displayMessage) {
|
|
31
|
-
setError(formatMessage(err.displayMessage, { size: SIZE, dimension: DIMENSION }));
|
|
32
|
-
} else {
|
|
33
|
-
throw err;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<form onSubmit={handleSubmit}>
|
|
40
|
-
<Box paddingLeft={8} paddingRight={8} paddingTop={6} paddingBottom={6}>
|
|
41
|
-
<TextInput
|
|
42
|
-
label={formatMessage({
|
|
43
|
-
id: 'Settings.application.customization.modal.upload.from-url.input-label',
|
|
44
|
-
defaultMessage: 'URL',
|
|
45
|
-
})}
|
|
46
|
-
error={error}
|
|
47
|
-
onChange={handleChange}
|
|
48
|
-
value={logoUrl}
|
|
49
|
-
name="logo-url"
|
|
50
|
-
/>
|
|
51
|
-
</Box>
|
|
52
|
-
<ModalFooter
|
|
53
|
-
startActions={
|
|
54
|
-
<Button onClick={onClose} variant="tertiary">
|
|
55
|
-
{formatMessage({ id: 'app.components.Button.cancel', defaultMessage: 'Cancel' })}
|
|
56
|
-
</Button>
|
|
57
|
-
}
|
|
58
|
-
endActions={
|
|
59
|
-
<Button type="submit">
|
|
60
|
-
{formatMessage({
|
|
61
|
-
id: 'Settings.application.customization.modal.upload.next',
|
|
62
|
-
defaultMessage: 'Next',
|
|
63
|
-
})}
|
|
64
|
-
</Button>
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
</form>
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
FromUrlForm.defaultProps = {
|
|
72
|
-
next: null,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
FromUrlForm.propTypes = {
|
|
76
|
-
goTo: PropTypes.func.isRequired,
|
|
77
|
-
next: PropTypes.string,
|
|
78
|
-
onClose: PropTypes.func.isRequired,
|
|
79
|
-
setLocalImage: PropTypes.func.isRequired,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default FromUrlForm;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
5
|
-
Card,
|
|
6
|
-
CardAsset,
|
|
7
|
-
CardBadge,
|
|
8
|
-
CardBody,
|
|
9
|
-
CardContent,
|
|
10
|
-
CardHeader,
|
|
11
|
-
CardTitle,
|
|
12
|
-
CardSubtitle,
|
|
13
|
-
} from '@strapi/design-system/Card';
|
|
14
|
-
|
|
15
|
-
const ImageCardAsset = ({ asset }) => {
|
|
16
|
-
const { formatMessage } = useIntl();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Card>
|
|
20
|
-
<CardHeader>
|
|
21
|
-
<CardAsset size="S" src={asset.url} />
|
|
22
|
-
</CardHeader>
|
|
23
|
-
<CardBody>
|
|
24
|
-
<CardContent>
|
|
25
|
-
<CardTitle>{asset.name}</CardTitle>
|
|
26
|
-
<CardSubtitle>
|
|
27
|
-
{`${asset.ext.toUpperCase()} - ${asset.width}✕${asset.height}`}
|
|
28
|
-
</CardSubtitle>
|
|
29
|
-
</CardContent>
|
|
30
|
-
<CardBadge>
|
|
31
|
-
{formatMessage({
|
|
32
|
-
id: 'Settings.application.customization.modal.pending.card-badge',
|
|
33
|
-
defaultMessage: 'image',
|
|
34
|
-
})}
|
|
35
|
-
</CardBadge>
|
|
36
|
-
</CardBody>
|
|
37
|
-
</Card>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
ImageCardAsset.propTypes = {
|
|
42
|
-
asset: PropTypes.shape({
|
|
43
|
-
name: PropTypes.string,
|
|
44
|
-
url: PropTypes.string,
|
|
45
|
-
width: PropTypes.number,
|
|
46
|
-
height: PropTypes.number,
|
|
47
|
-
ext: PropTypes.string,
|
|
48
|
-
}).isRequired,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default ImageCardAsset;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { pxToRem } from '@strapi/helper-plugin';
|
|
5
|
-
import { Box } from '@strapi/design-system/Box';
|
|
6
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
7
|
-
import { Button } from '@strapi/design-system/Button';
|
|
8
|
-
import { ModalFooter } from '@strapi/design-system/ModalLayout';
|
|
9
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
10
|
-
import ImageCardAsset from './ImageCardAsset';
|
|
11
|
-
|
|
12
|
-
const PendingLogoDialog = ({ onClose, asset, prev, next, goTo, setLocalImage, onChangeLogo }) => {
|
|
13
|
-
const { formatMessage } = useIntl();
|
|
14
|
-
|
|
15
|
-
const handleGoBack = () => {
|
|
16
|
-
setLocalImage(undefined);
|
|
17
|
-
goTo(prev);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const handleUpload = () => {
|
|
21
|
-
onChangeLogo(asset);
|
|
22
|
-
goTo(next);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<Box paddingLeft={8} paddingRight={8} paddingTop={6} paddingBottom={6}>
|
|
28
|
-
<Flex justifyContent="space-between" paddingBottom={6}>
|
|
29
|
-
<Flex direction="column" alignItems="flex-start">
|
|
30
|
-
<Typography variant="pi" fontWeight="bold">
|
|
31
|
-
{formatMessage({
|
|
32
|
-
id: 'Settings.application.customization.modal.pending.title',
|
|
33
|
-
defaultMessage: 'Logo ready to upload',
|
|
34
|
-
})}
|
|
35
|
-
</Typography>
|
|
36
|
-
<Typography variant="pi" textColor="neutral500">
|
|
37
|
-
{formatMessage({
|
|
38
|
-
id: 'Settings.application.customization.modal.pending.subtitle',
|
|
39
|
-
defaultMessage: 'Manage the chosen logo before uploading it',
|
|
40
|
-
})}
|
|
41
|
-
</Typography>
|
|
42
|
-
</Flex>
|
|
43
|
-
<Button onClick={handleGoBack} variant="secondary">
|
|
44
|
-
{formatMessage({
|
|
45
|
-
id: 'Settings.application.customization.modal.pending.choose-another',
|
|
46
|
-
defaultMessage: 'Choose another logo',
|
|
47
|
-
})}
|
|
48
|
-
</Button>
|
|
49
|
-
</Flex>
|
|
50
|
-
<Box maxWidth={pxToRem(180)}>
|
|
51
|
-
<ImageCardAsset asset={asset} />
|
|
52
|
-
</Box>
|
|
53
|
-
</Box>
|
|
54
|
-
<ModalFooter
|
|
55
|
-
startActions={
|
|
56
|
-
<Button onClick={onClose} variant="tertiary">
|
|
57
|
-
{formatMessage({
|
|
58
|
-
id: 'Settings.application.customization.modal.cancel',
|
|
59
|
-
defaultMessage: 'Cancel',
|
|
60
|
-
})}
|
|
61
|
-
</Button>
|
|
62
|
-
}
|
|
63
|
-
endActions={
|
|
64
|
-
<Button onClick={handleUpload}>
|
|
65
|
-
{formatMessage({
|
|
66
|
-
id: 'Settings.application.customization.modal.pending.upload',
|
|
67
|
-
defaultMessage: 'Upload logo',
|
|
68
|
-
})}
|
|
69
|
-
</Button>
|
|
70
|
-
}
|
|
71
|
-
/>
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
PendingLogoDialog.defaultProps = {
|
|
77
|
-
next: null,
|
|
78
|
-
prev: null,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
PendingLogoDialog.propTypes = {
|
|
82
|
-
goTo: PropTypes.func.isRequired,
|
|
83
|
-
asset: PropTypes.shape({
|
|
84
|
-
name: PropTypes.string,
|
|
85
|
-
url: PropTypes.string,
|
|
86
|
-
width: PropTypes.number,
|
|
87
|
-
height: PropTypes.number,
|
|
88
|
-
ext: PropTypes.string,
|
|
89
|
-
}).isRequired,
|
|
90
|
-
next: PropTypes.string,
|
|
91
|
-
onClose: PropTypes.func.isRequired,
|
|
92
|
-
onChangeLogo: PropTypes.func.isRequired,
|
|
93
|
-
prev: PropTypes.string,
|
|
94
|
-
setLocalImage: PropTypes.func.isRequired,
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default PendingLogoDialog;
|