@strapi/admin 4.2.0-alpha.1 → 4.2.0-alpha.5

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.
Files changed (66) hide show
  1. package/admin/src/StrapiApp.js +42 -40
  2. package/admin/src/app.js +7 -4
  3. package/admin/src/components/GuidedTour/Homepage/index.js +13 -3
  4. package/admin/src/components/GuidedTour/Modal/components/Modal.js +1 -1
  5. package/admin/src/components/GuidedTour/Modal/index.js +4 -1
  6. package/admin/src/components/GuidedTour/layout.js +9 -0
  7. package/admin/src/components/Providers/index.js +32 -65
  8. package/admin/src/components/Theme/index.js +12 -11
  9. package/admin/src/content-manager/components/Inputs/index.js +3 -4
  10. package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +1 -3
  11. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +2 -4
  12. package/admin/src/contexts/index.js +0 -1
  13. package/admin/src/hooks/index.js +0 -1
  14. package/admin/src/pages/Admin/Onboarding/index.js +1 -1
  15. package/admin/src/pages/AuthPage/index.js +1 -0
  16. package/admin/src/pages/HomePage/SocialLinks.js +3 -0
  17. package/admin/src/pages/ProfilePage/index.js +10 -74
  18. package/admin/src/pages/ProfilePage/utils/api.js +2 -4
  19. package/admin/src/themes/colors.js +51 -0
  20. package/admin/src/themes/fontWeights.js +8 -0
  21. package/admin/src/themes/index.js +13 -0
  22. package/admin/src/themes/sizes.js +31 -0
  23. package/admin/src/translations/en.json +4 -7
  24. package/admin/src/translations/ja.json +2 -2
  25. package/admin/src/translations/ko.json +2 -2
  26. package/build/4362.dbe98749.chunk.js +1 -0
  27. package/build/{6404.3c2d0a81.chunk.js → 6250.836851ca.chunk.js} +1 -1
  28. package/build/9260.d9bb874f.chunk.js +2 -0
  29. package/build/{9260.fa40c7bd.chunk.js.LICENSE.txt → 9260.d9bb874f.chunk.js.LICENSE.txt} +0 -0
  30. package/build/Admin-authenticatedApp.a24ebaa0.chunk.js +1 -0
  31. package/build/Admin_homePage.86604515.chunk.js +1 -0
  32. package/build/Admin_profilePage.c497b39d.chunk.js +1 -0
  33. package/build/{Admin_settingsPage.a8c7ded5.chunk.js → Admin_settingsPage.55ec1f30.chunk.js} +1 -1
  34. package/build/content-manager.31be1448.chunk.js +1 -0
  35. package/build/{content-type-builder.cda4ba3c.chunk.js → content-type-builder.de5d18ad.chunk.js} +1 -1
  36. package/build/{email-settings-page.40ee2bda.chunk.js → email-settings-page.27ee4a98.chunk.js} +1 -1
  37. package/build/en-json.bce44d39.chunk.js +1 -0
  38. package/build/index.html +1 -1
  39. package/build/ja-json.e13f04e8.chunk.js +1 -0
  40. package/build/ko-json.2200c9c9.chunk.js +1 -0
  41. package/build/{main.34ee547b.js → main.4ea77c5f.js} +2 -2
  42. package/build/{main.34ee547b.js.LICENSE.txt → main.4ea77c5f.js.LICENSE.txt} +0 -0
  43. package/build/{runtime~main.3ef9943c.js → runtime~main.83b9ee0b.js} +1 -1
  44. package/build/users-email-settings-page.862eb51e.chunk.js +1 -0
  45. package/index.js +53 -244
  46. package/package.json +7 -5
  47. package/server/routes/serve-admin-panel.js +1 -1
  48. package/utils/create-cache-dir.js +119 -0
  49. package/utils/get-custom-webpack-config.js +38 -0
  50. package/utils/index.js +13 -0
  51. package/utils/should-build-admin.js +51 -0
  52. package/utils/watch-admin-files.js +56 -0
  53. package/webpack.config.js +36 -3
  54. package/admin/src/components/ThemeToggleProvider/index.js +0 -66
  55. package/admin/src/contexts/ThemeToggle/index.js +0 -5
  56. package/admin/src/hooks/useThemeToggle/index.js +0 -10
  57. package/build/4362.86a4e939.chunk.js +0 -1
  58. package/build/9260.fa40c7bd.chunk.js +0 -2
  59. package/build/Admin-authenticatedApp.2d44e117.chunk.js +0 -1
  60. package/build/Admin_homePage.d6754c66.chunk.js +0 -1
  61. package/build/Admin_profilePage.d7192d06.chunk.js +0 -1
  62. package/build/content-manager.de808f2c.chunk.js +0 -1
  63. package/build/en-json.b35c285f.chunk.js +0 -1
  64. package/build/ja-json.46e29f04.chunk.js +0 -1
  65. package/build/ko-json.dd36fdc0.chunk.js +0 -1
  66. package/build/users-email-settings-page.5abb9575.chunk.js +0 -1
@@ -9,13 +9,12 @@ import {
9
9
  useNotification,
10
10
  useOverlayBlocker,
11
11
  auth,
12
- useTracking,
13
12
  } from '@strapi/helper-plugin';
14
13
  import { useIntl } from 'react-intl';
15
14
  import { Formik } from 'formik';
16
- import upperFirst from 'lodash/upperFirst';
17
15
  import { useQuery, useMutation, useQueryClient } from 'react-query';
18
16
  import pick from 'lodash/pick';
17
+ import omit from 'lodash/omit';
19
18
  import { Helmet } from 'react-helmet';
20
19
  import { Main } from '@strapi/design-system/Main';
21
20
  import { Typography } from '@strapi/design-system/Typography';
@@ -32,15 +31,10 @@ import Eye from '@strapi/icons/Eye';
32
31
  import EyeStriked from '@strapi/icons/EyeStriked';
33
32
  import Check from '@strapi/icons/Check';
34
33
  import useLocalesProvider from '../../components/LocalesProvider/useLocalesProvider';
35
- import { useThemeToggle } from '../../hooks';
36
34
  import { fetchUser, putUser } from './utils/api';
37
35
  import schema from './utils/schema';
38
36
  import { getFullName } from '../../utils';
39
37
 
40
- const DocumentationLink = styled.a`
41
- color: ${({ theme }) => theme.colors.primary600};
42
- `;
43
-
44
38
  const PasswordInput = styled(TextInput)`
45
39
  ::-ms-reveal {
46
40
  display: none;
@@ -65,11 +59,9 @@ const ProfilePage = () => {
65
59
  const { setUserDisplayName } = useAppInfos();
66
60
  const queryClient = useQueryClient();
67
61
  const { formatMessage } = useIntl();
68
- const { trackUsage } = useTracking();
69
62
  const toggleNotification = useNotification();
70
63
  const { lockApp, unlockApp } = useOverlayBlocker();
71
64
  const { notifyStatus } = useNotifyAT();
72
- const { currentTheme, themes: allApplicationThemes, onChangeTheme } = useThemeToggle();
73
65
  useFocusWhenNavigate();
74
66
 
75
67
  const { status, data } = useQuery('user', () => fetchUser(), {
@@ -91,18 +83,14 @@ const ProfilePage = () => {
91
83
 
92
84
  const isLoading = status !== 'success';
93
85
 
94
- const submitMutation = useMutation(body => putUser(body), {
86
+ const submitMutation = useMutation(body => putUser(omit(body, 'confirmPassword')), {
95
87
  onSuccess: async data => {
96
88
  await queryClient.invalidateQueries('user');
97
89
 
98
- auth.setUserInfo(
99
- pick(data, ['email', 'firstname', 'lastname', 'username', 'preferedLanguage'])
100
- );
90
+ auth.setUserInfo(data);
101
91
  const userDisplayName = data.username || getFullName(data.firstname, data.lastname);
102
92
  setUserDisplayName(userDisplayName);
103
93
  changeLocale(data.preferedLanguage);
104
- onChangeTheme(data.currentTheme);
105
- trackUsage('didChangeMode', { newMode: data.currentTheme });
106
94
 
107
95
  toggleNotification({
108
96
  type: 'success',
@@ -140,16 +128,9 @@ const ProfilePage = () => {
140
128
  );
141
129
  };
142
130
 
143
- const fieldsToPick = [
144
- 'currentTheme',
145
- 'email',
146
- 'firstname',
147
- 'lastname',
148
- 'username',
149
- 'preferedLanguage',
150
- ];
131
+ const fieldsToPick = ['email', 'firstname', 'lastname', 'username', 'preferedLanguage'];
151
132
 
152
- const initialData = pick({ ...data, currentTheme }, fieldsToPick);
133
+ const initialData = pick(data, fieldsToPick);
153
134
 
154
135
  if (isLoading) {
155
136
  return (
@@ -173,10 +154,6 @@ const ProfilePage = () => {
173
154
  );
174
155
  }
175
156
 
176
- const themesToDisplay = Object.keys(allApplicationThemes).filter(
177
- themeName => allApplicationThemes[themeName]
178
- );
179
-
180
157
  return (
181
158
  <Main aria-busy={isSubmittingForm}>
182
159
  <Helmet
@@ -447,20 +424,20 @@ const ProfilePage = () => {
447
424
  id:
448
425
  'Settings.profile.form.section.experience.interfaceLanguageHelp',
449
426
  defaultMessage:
450
- 'Preference changes will apply only to you. More information is available {here}.',
427
+ 'Selection will change the interface language only for you. Please refer to this {documentation} to make other languages available for your team.',
451
428
  },
452
429
  {
453
- here: (
454
- <DocumentationLink
430
+ documentation: (
431
+ <a
455
432
  target="_blank"
456
433
  rel="noopener noreferrer"
457
434
  href="https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#locales"
458
435
  >
459
436
  {formatMessage({
460
437
  id: 'Settings.profile.form.section.experience.documentation',
461
- defaultMessage: 'here',
438
+ defaultMessage: 'documentation',
462
439
  })}
463
- </DocumentationLink>
440
+ </a>
464
441
  ),
465
442
  }
466
443
  )}
@@ -510,47 +487,6 @@ const ProfilePage = () => {
510
487
  })}
511
488
  </Select>
512
489
  </GridItem>
513
- <GridItem s={12} col={6}>
514
- <Select
515
- label={formatMessage({
516
- id: 'Settings.profile.form.section.experience.mode.label',
517
- defaultMessage: 'Interface mode',
518
- })}
519
- placeholder={formatMessage({
520
- id: 'components.Select.placeholder',
521
- defaultMessage: 'Select',
522
- })}
523
- hint={formatMessage({
524
- id: 'Settings.profile.form.section.experience.mode.hint',
525
- defaultMessage: 'Displays your interface in the chosen mode.',
526
- })}
527
- value={values.currentTheme}
528
- onChange={e => {
529
- handleChange({
530
- target: { name: 'currentTheme', value: e },
531
- });
532
- }}
533
- >
534
- {themesToDisplay.map(theme => {
535
- const label = formatMessage(
536
- {
537
- id:
538
- 'Settings.profile.form.section.experience.mode.option-label',
539
- defaultMessage: '{name} mode',
540
- },
541
- {
542
- name: upperFirst(theme),
543
- }
544
- );
545
-
546
- return (
547
- <Option value={theme} key={theme}>
548
- {label}
549
- </Option>
550
- );
551
- })}
552
- </Select>
553
- </GridItem>
554
490
  </Grid>
555
491
  </Stack>
556
492
  </Box>
@@ -1,4 +1,3 @@
1
- import omit from 'lodash/omit';
2
1
  import { axiosInstance } from '../../../core/utils';
3
2
 
4
3
  const fetchUser = async () => {
@@ -8,10 +7,9 @@ const fetchUser = async () => {
8
7
  };
9
8
 
10
9
  const putUser = async body => {
11
- const dataToSend = omit(body, ['confirmPassword', 'currentTheme']);
12
- const { data } = await axiosInstance.put('/admin/users/me', dataToSend);
10
+ const { data } = await axiosInstance.put('/admin/users/me', body);
13
11
 
14
- return { ...data.data, currentTheme: body.currentTheme };
12
+ return data.data;
15
13
  };
16
14
 
17
15
  export { fetchUser, putUser };
@@ -0,0 +1,51 @@
1
+ const colors = {
2
+ black: '#333740',
3
+ white: '#ffffff',
4
+ red: '#ff203c',
5
+ orange: '#ff5d00',
6
+ lightOrange: '#f64d0a',
7
+ yellow: '#ffd500',
8
+ green: '#6dbb1a',
9
+ blue: '#0097f7',
10
+ teal: '#5bc0de',
11
+ pink: '#ff5b77',
12
+ purple: '#613d7c',
13
+ gray: '#464a4c',
14
+ border: '#e3e9f3',
15
+ 'gray-dark': '#292b2c',
16
+ grayLight: '#636c72',
17
+ 'gray-lighter': '#eceeef',
18
+ 'gray-lightest': '#f7f7f9',
19
+ brightGrey: '#f0f3f8',
20
+ darkGrey: '#e3e9f3',
21
+ lightGrey: '#fafafa',
22
+ lightestGrey: '#fbfbfb',
23
+ mediumGrey: '#f2f3f4',
24
+ grey: '#9ea7b8',
25
+ greyDark: '#292b2c',
26
+ greyAlpha: 'rgba(227, 233, 243, 0.5)',
27
+ lightestBlue: '#e4f0fc',
28
+ lightBlue: '#e6f0fb',
29
+ mediumBlue: '#007eff',
30
+ darkBlue: '#aed4fb',
31
+ pale: '#f7f8f8',
32
+ content: {
33
+ background: '#fafafb',
34
+ 'background-alpha': 'rgba(14, 22, 34, 0.02)',
35
+ },
36
+ leftMenu: {
37
+ 'link-hover': '#1c2431',
38
+ 'link-color': '#919bae',
39
+ 'title-color': '#5b626f',
40
+ 'background-header-link': '#007eff',
41
+ },
42
+ strapi: {
43
+ 'gray-light': '#eff3f6',
44
+ gray: '#535f76',
45
+ 'blue-darker': '#18202e',
46
+ 'blue-dark': '#151c2e',
47
+ blue: '#0097f7',
48
+ },
49
+ };
50
+
51
+ export default colors;
@@ -0,0 +1,8 @@
1
+ const fontWeights = {
2
+ regular: 400,
3
+ semiBold: 500,
4
+ bold: 600,
5
+ black: 900,
6
+ };
7
+
8
+ export default fontWeights;
@@ -0,0 +1,13 @@
1
+ import colors from './colors';
2
+ import fontWeights from './fontWeights';
3
+ import sizes from './sizes';
4
+
5
+ const theme = {
6
+ main: {
7
+ colors,
8
+ fontWeights,
9
+ sizes,
10
+ },
11
+ };
12
+
13
+ export default theme;
@@ -0,0 +1,31 @@
1
+ const sizes = {
2
+ borderRadius: '2px',
3
+ header: {
4
+ height: '6rem',
5
+ },
6
+ leftMenu: {
7
+ height: '6rem',
8
+ width: '24rem',
9
+ },
10
+ margins: {
11
+ // TODO:
12
+ sm: '10px',
13
+ },
14
+ paddings: {
15
+ // TODO
16
+ xs: '5px',
17
+ sm: '10px',
18
+ smd: '20px',
19
+ md: '30px',
20
+ lg: '40px',
21
+ },
22
+ fonts: {
23
+ xs: '11px',
24
+ sm: '12px',
25
+ md: '13px',
26
+ lg: '18px',
27
+ xl: '24px',
28
+ },
29
+ };
30
+
31
+ export default sizes;
@@ -133,13 +133,10 @@
133
133
  "Settings.permissions.users.tabs.label": "Tabs Permissions",
134
134
  "Settings.profile.form.notify.data.loaded": "Your profile data has been loaded",
135
135
  "Settings.profile.form.section.experience.clear.select": "Clear the interface language selected",
136
- "Settings.profile.form.section.experience.here": "here",
136
+ "Settings.profile.form.section.experience.documentation": "documentation",
137
137
  "Settings.profile.form.section.experience.interfaceLanguage": "Interface language",
138
138
  "Settings.profile.form.section.experience.interfaceLanguage.hint": "This will only display your own interface in the chosen language.",
139
- "Settings.profile.form.section.experience.interfaceLanguageHelp": "Preference changes will apply only to you. More information is available {here}.",
140
- "Settings.profile.form.section.experience.mode.label": "Interface mode",
141
- "Settings.profile.form.section.experience.mode.hint": "Displays your interface in the chosen mode.",
142
- "Settings.profile.form.section.experience.mode.option-label": "{name} mode",
139
+ "Settings.profile.form.section.experience.interfaceLanguageHelp": "Selection will change the interface language only for you. Please refer to this {documentation} to make other languages available for your team.",
143
140
  "Settings.profile.form.section.experience.title": "Experience",
144
141
  "Settings.profile.form.section.helmet.title": "User profile",
145
142
  "Settings.profile.form.section.password.title": "Change password",
@@ -357,8 +354,8 @@
357
354
  "app.components.PluginCard.compatible": "Compatible with your app",
358
355
  "app.components.PluginCard.compatibleCommunity": "Compatible with the community",
359
356
  "app.components.PluginCard.more-details": "More details",
360
- "app.components.ToggleCheckbox.off-label": "Off",
361
- "app.components.ToggleCheckbox.on-label": "On",
357
+ "app.components.ToggleCheckbox.off-label": "False",
358
+ "app.components.ToggleCheckbox.on-label": "True",
362
359
  "app.components.UpgradePlanModal.button": "Learn more",
363
360
  "app.components.UpgradePlanModal.limit-reached": "You have reached the limit",
364
361
  "app.components.UpgradePlanModal.text-ce": "Community Edition",
@@ -315,8 +315,8 @@
315
315
  "app.components.PluginCard.compatible": "アプリとの互換性",
316
316
  "app.components.PluginCard.compatibleCommunity": "コミュニティとの互換性",
317
317
  "app.components.PluginCard.more-details": "詳細を見る",
318
- "app.components.ToggleCheckbox.off-label": "Off",
319
- "app.components.ToggleCheckbox.on-label": "On",
318
+ "app.components.ToggleCheckbox.off-label": "False",
319
+ "app.components.ToggleCheckbox.on-label": "True",
320
320
  "app.components.UpgradePlanModal.button": "Learn more",
321
321
  "app.components.UpgradePlanModal.limit-reached": "You have reached the limit",
322
322
  "app.components.UpgradePlanModal.text-ce": "Community Edition",
@@ -317,8 +317,8 @@
317
317
  "app.components.PluginCard.compatible": "이 애플리케이션에 호환됩니다.",
318
318
  "app.components.PluginCard.compatibleCommunity": "션뮤니티에 호환됩니다.",
319
319
  "app.components.PluginCard.more-details": "[더보기]",
320
- "app.components.ToggleCheckbox.off-label": "Off",
321
- "app.components.ToggleCheckbox.on-label": "On",
320
+ "app.components.ToggleCheckbox.off-label": "False",
321
+ "app.components.ToggleCheckbox.on-label": "True",
322
322
  "app.components.UpgradePlanModal.button": "Learn more",
323
323
  "app.components.UpgradePlanModal.limit-reached": "You have reached the limit",
324
324
  "app.components.UpgradePlanModal.text-ce": "Community Edition",