@strapi/admin 4.1.4-alpha.0 → 4.2.0-alpha.1

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 (69) hide show
  1. package/.env +0 -0
  2. package/admin/src/StrapiApp.js +40 -42
  3. package/admin/src/components/GuidedTour/Modal/components/Modal.js +1 -1
  4. package/admin/src/components/Providers/index.js +65 -32
  5. package/admin/src/components/Theme/index.js +11 -12
  6. package/admin/src/components/ThemeToggleProvider/index.js +66 -0
  7. package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +3 -1
  8. package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +4 -2
  9. package/admin/src/contexts/ThemeToggle/index.js +5 -0
  10. package/admin/src/contexts/index.js +1 -0
  11. package/admin/src/hooks/index.js +2 -0
  12. package/admin/src/hooks/useFetchPluginsFromMarketPlace/index.js +49 -0
  13. package/admin/src/hooks/useThemeToggle/index.js +10 -0
  14. package/admin/src/pages/Admin/Onboarding/index.js +1 -1
  15. package/admin/src/pages/HomePage/SocialLinks.js +0 -3
  16. package/admin/src/pages/InstalledPluginsPage/Plugins.js +15 -6
  17. package/admin/src/{hooks/useFetchInstalledPlugins → pages/InstalledPluginsPage}/utils/api.js +4 -2
  18. package/admin/src/pages/MarketplacePage/MarketplaceBanner/Wrapper.js +28 -0
  19. package/admin/src/pages/MarketplacePage/MarketplaceBanner/index.js +37 -0
  20. package/admin/src/pages/MarketplacePage/PluginCard/Wrapper.js +148 -0
  21. package/admin/src/pages/MarketplacePage/PluginCard/index.js +185 -0
  22. package/admin/src/pages/MarketplacePage/Wrapper.js +5 -0
  23. package/admin/src/pages/MarketplacePage/assets/marketplace-coming-soon.png +0 -0
  24. package/admin/src/pages/MarketplacePage/index.js +109 -198
  25. package/admin/src/pages/ProfilePage/index.js +74 -10
  26. package/admin/src/pages/ProfilePage/utils/api.js +4 -2
  27. package/admin/src/translations/en.json +18 -18
  28. package/build/01a600d9e6e0dea21e33.png +0 -0
  29. package/build/4362.86a4e939.chunk.js +1 -0
  30. package/build/{6250.836851ca.chunk.js → 6404.3c2d0a81.chunk.js} +1 -1
  31. package/build/{Admin-authenticatedApp.27fba46d.chunk.js → Admin-authenticatedApp.2d44e117.chunk.js} +1 -1
  32. package/build/{Admin_homePage.964ff5d7.chunk.js → Admin_homePage.d6754c66.chunk.js} +1 -1
  33. package/build/Admin_marketplace.419010d8.chunk.js +1 -0
  34. package/build/Admin_pluginsPage.7d1bd7ce.chunk.js +1 -0
  35. package/build/Admin_profilePage.d7192d06.chunk.js +1 -0
  36. package/build/{Admin_settingsPage.55ec1f30.chunk.js → Admin_settingsPage.a8c7ded5.chunk.js} +1 -1
  37. package/build/admin-users.1fda1f27.chunk.js +1 -0
  38. package/build/content-manager.de808f2c.chunk.js +1 -0
  39. package/build/{content-type-builder.de5d18ad.chunk.js → content-type-builder.cda4ba3c.chunk.js} +1 -1
  40. package/build/{email-settings-page.27ee4a98.chunk.js → email-settings-page.40ee2bda.chunk.js} +1 -1
  41. package/build/en-json.b35c285f.chunk.js +1 -0
  42. package/build/index.html +1 -1
  43. package/build/{main.22e9a5c5.js → main.34ee547b.js} +2 -2
  44. package/build/{main.22e9a5c5.js.LICENSE.txt → main.34ee547b.js.LICENSE.txt} +0 -0
  45. package/build/{runtime~main.e6326927.js → runtime~main.3ef9943c.js} +1 -1
  46. package/build/users-email-settings-page.5abb9575.chunk.js +1 -0
  47. package/package.json +5 -5
  48. package/server/controllers/admin.js +1 -12
  49. package/admin/src/assets/images/icon_made-by-strapi.svg +0 -5
  50. package/admin/src/hooks/useFetchInstalledPlugins/index.js +0 -23
  51. package/admin/src/hooks/useFetchMarketplacePlugins/index.js +0 -23
  52. package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +0 -17
  53. package/admin/src/pages/MarketplacePage/components/EmptyPluginSearch/EmptyPluginGrid.js +0 -27
  54. package/admin/src/pages/MarketplacePage/components/EmptyPluginSearch/index.js +0 -30
  55. package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +0 -186
  56. package/admin/src/pages/MarketplacePage/utils/api.js +0 -9
  57. package/admin/src/themes/colors.js +0 -51
  58. package/admin/src/themes/fontWeights.js +0 -8
  59. package/admin/src/themes/index.js +0 -13
  60. package/admin/src/themes/sizes.js +0 -31
  61. package/build/4362.5c92d240.chunk.js +0 -1
  62. package/build/90f49a385afb000fb1d4.svg +0 -5
  63. package/build/Admin_marketplace.e83567ff.chunk.js +0 -1
  64. package/build/Admin_pluginsPage.97a514db.chunk.js +0 -1
  65. package/build/Admin_profilePage.c497b39d.chunk.js +0 -1
  66. package/build/admin-users.2740c223.chunk.js +0 -1
  67. package/build/content-manager.e1189026.chunk.js +0 -1
  68. package/build/en-json.086acf41.chunk.js +0 -1
  69. package/build/users-email-settings-page.862eb51e.chunk.js +0 -1
@@ -9,12 +9,13 @@ import {
9
9
  useNotification,
10
10
  useOverlayBlocker,
11
11
  auth,
12
+ useTracking,
12
13
  } from '@strapi/helper-plugin';
13
14
  import { useIntl } from 'react-intl';
14
15
  import { Formik } from 'formik';
16
+ import upperFirst from 'lodash/upperFirst';
15
17
  import { useQuery, useMutation, useQueryClient } from 'react-query';
16
18
  import pick from 'lodash/pick';
17
- import omit from 'lodash/omit';
18
19
  import { Helmet } from 'react-helmet';
19
20
  import { Main } from '@strapi/design-system/Main';
20
21
  import { Typography } from '@strapi/design-system/Typography';
@@ -31,10 +32,15 @@ import Eye from '@strapi/icons/Eye';
31
32
  import EyeStriked from '@strapi/icons/EyeStriked';
32
33
  import Check from '@strapi/icons/Check';
33
34
  import useLocalesProvider from '../../components/LocalesProvider/useLocalesProvider';
35
+ import { useThemeToggle } from '../../hooks';
34
36
  import { fetchUser, putUser } from './utils/api';
35
37
  import schema from './utils/schema';
36
38
  import { getFullName } from '../../utils';
37
39
 
40
+ const DocumentationLink = styled.a`
41
+ color: ${({ theme }) => theme.colors.primary600};
42
+ `;
43
+
38
44
  const PasswordInput = styled(TextInput)`
39
45
  ::-ms-reveal {
40
46
  display: none;
@@ -59,9 +65,11 @@ const ProfilePage = () => {
59
65
  const { setUserDisplayName } = useAppInfos();
60
66
  const queryClient = useQueryClient();
61
67
  const { formatMessage } = useIntl();
68
+ const { trackUsage } = useTracking();
62
69
  const toggleNotification = useNotification();
63
70
  const { lockApp, unlockApp } = useOverlayBlocker();
64
71
  const { notifyStatus } = useNotifyAT();
72
+ const { currentTheme, themes: allApplicationThemes, onChangeTheme } = useThemeToggle();
65
73
  useFocusWhenNavigate();
66
74
 
67
75
  const { status, data } = useQuery('user', () => fetchUser(), {
@@ -83,14 +91,18 @@ const ProfilePage = () => {
83
91
 
84
92
  const isLoading = status !== 'success';
85
93
 
86
- const submitMutation = useMutation(body => putUser(omit(body, 'confirmPassword')), {
94
+ const submitMutation = useMutation(body => putUser(body), {
87
95
  onSuccess: async data => {
88
96
  await queryClient.invalidateQueries('user');
89
97
 
90
- auth.setUserInfo(data);
98
+ auth.setUserInfo(
99
+ pick(data, ['email', 'firstname', 'lastname', 'username', 'preferedLanguage'])
100
+ );
91
101
  const userDisplayName = data.username || getFullName(data.firstname, data.lastname);
92
102
  setUserDisplayName(userDisplayName);
93
103
  changeLocale(data.preferedLanguage);
104
+ onChangeTheme(data.currentTheme);
105
+ trackUsage('didChangeMode', { newMode: data.currentTheme });
94
106
 
95
107
  toggleNotification({
96
108
  type: 'success',
@@ -128,9 +140,16 @@ const ProfilePage = () => {
128
140
  );
129
141
  };
130
142
 
131
- const fieldsToPick = ['email', 'firstname', 'lastname', 'username', 'preferedLanguage'];
143
+ const fieldsToPick = [
144
+ 'currentTheme',
145
+ 'email',
146
+ 'firstname',
147
+ 'lastname',
148
+ 'username',
149
+ 'preferedLanguage',
150
+ ];
132
151
 
133
- const initialData = pick(data, fieldsToPick);
152
+ const initialData = pick({ ...data, currentTheme }, fieldsToPick);
134
153
 
135
154
  if (isLoading) {
136
155
  return (
@@ -154,6 +173,10 @@ const ProfilePage = () => {
154
173
  );
155
174
  }
156
175
 
176
+ const themesToDisplay = Object.keys(allApplicationThemes).filter(
177
+ themeName => allApplicationThemes[themeName]
178
+ );
179
+
157
180
  return (
158
181
  <Main aria-busy={isSubmittingForm}>
159
182
  <Helmet
@@ -424,20 +447,20 @@ const ProfilePage = () => {
424
447
  id:
425
448
  'Settings.profile.form.section.experience.interfaceLanguageHelp',
426
449
  defaultMessage:
427
- 'Selection will change the interface language only for you. Please refer to this {documentation} to make other languages available for your team.',
450
+ 'Preference changes will apply only to you. More information is available {here}.',
428
451
  },
429
452
  {
430
- documentation: (
431
- <a
453
+ here: (
454
+ <DocumentationLink
432
455
  target="_blank"
433
456
  rel="noopener noreferrer"
434
457
  href="https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#locales"
435
458
  >
436
459
  {formatMessage({
437
460
  id: 'Settings.profile.form.section.experience.documentation',
438
- defaultMessage: 'documentation',
461
+ defaultMessage: 'here',
439
462
  })}
440
- </a>
463
+ </DocumentationLink>
441
464
  ),
442
465
  }
443
466
  )}
@@ -487,6 +510,47 @@ const ProfilePage = () => {
487
510
  })}
488
511
  </Select>
489
512
  </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>
490
554
  </Grid>
491
555
  </Stack>
492
556
  </Box>
@@ -1,3 +1,4 @@
1
+ import omit from 'lodash/omit';
1
2
  import { axiosInstance } from '../../../core/utils';
2
3
 
3
4
  const fetchUser = async () => {
@@ -7,9 +8,10 @@ const fetchUser = async () => {
7
8
  };
8
9
 
9
10
  const putUser = async body => {
10
- const { data } = await axiosInstance.put('/admin/users/me', body);
11
+ const dataToSend = omit(body, ['confirmPassword', 'currentTheme']);
12
+ const { data } = await axiosInstance.put('/admin/users/me', dataToSend);
11
13
 
12
- return data.data;
14
+ return { ...data.data, currentTheme: body.currentTheme };
13
15
  };
14
16
 
15
17
  export { fetchUser, putUser };
@@ -58,21 +58,6 @@
58
58
  "Auth.privacy-policy-agreement.policy": "privacy policy",
59
59
  "Auth.privacy-policy-agreement.terms": "terms",
60
60
  "Auth.reset-password.title": "Reset password",
61
- "admin.pages.MarketPlacePage.helmet": "Marketplace - Plugins",
62
- "admin.pages.MarketPlacePage.title": "Marketplace",
63
- "admin.pages.MarketPlacePage.subtitle": "Get more out of Strapi",
64
- "admin.pages.MarketPlacePage.plugin.info.text": "Learn more",
65
- "admin.pages.MarketPlacePage.plugin.info.label": "Learn more about {pluginName}",
66
- "admin.pages.MarketPlacePage.plugin.copy": "Copy install command",
67
- "admin.pages.MarketPlacePage.plugin.copy.success": "Install command ready to be pasted in your terminal",
68
- "admin.pages.MarketPlacePage.plugin.installed": "Installed",
69
- "admin.pages.MarketPlacePage.plugin.info": "Learn more",
70
- "admin.pages.MarketPlacePage.submit.plugin.link": "Submit your plugin",
71
- "admin.pages.MarketPlacePage.plugin.tooltip.verified": "Plugin verified by Strapi",
72
- "admin.pages.MarketPlacePage.search.placeholder": "Search for a plugin",
73
- "admin.pages.MarketPlacePage.search.clear": "Clear the plugin search",
74
- "admin.pages.MarketPlacePage.search.empty": "No result for \"{target}\"",
75
- "admin.pages.MarketPlacePage.plugin.tooltip.madeByStrapi": "Made by Strapi",
76
61
  "Content Manager": "Content Manager",
77
62
  "Content Type Builder": "Content-Types Builder",
78
63
  "Documentation": "Documentation",
@@ -148,10 +133,13 @@
148
133
  "Settings.permissions.users.tabs.label": "Tabs Permissions",
149
134
  "Settings.profile.form.notify.data.loaded": "Your profile data has been loaded",
150
135
  "Settings.profile.form.section.experience.clear.select": "Clear the interface language selected",
151
- "Settings.profile.form.section.experience.documentation": "documentation",
136
+ "Settings.profile.form.section.experience.here": "here",
152
137
  "Settings.profile.form.section.experience.interfaceLanguage": "Interface language",
153
138
  "Settings.profile.form.section.experience.interfaceLanguage.hint": "This will only display your own interface in the chosen language.",
154
- "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.",
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",
155
143
  "Settings.profile.form.section.experience.title": "Experience",
156
144
  "Settings.profile.form.section.helmet.title": "User profile",
157
145
  "Settings.profile.form.section.password.title": "Change password",
@@ -242,6 +230,18 @@
242
230
  "Users.components.List.empty": "There is no users...",
243
231
  "Users.components.List.empty.withFilters": "There is no users with the applied filters...",
244
232
  "Users.components.List.empty.withSearch": "There is no users corresponding to the search ({search})...",
233
+ "admin.pages.MarketPlacePage.blog.link": "Read our blog post",
234
+ "admin.pages.MarketPlacePage.coming-soon.1": "A new way to make Strapi awesome.",
235
+ "admin.pages.MarketPlacePage.coming-soon.2": "Coming soon.",
236
+ "admin.pages.MarketPlacePage.content.subtitle": "The new marketplace will help you get more out of Strapi. We are working hard to offer the best experience to discover and install plugins.",
237
+ "admin.pages.MarketPlacePage.content.subtitle.published": "The web marketplace helps you get the most of Strapi. In addition, we are working hard to offer the best experience to discover and install plugins, directly from the app.",
238
+ "admin.pages.MarketPlacePage.helmet": "Marketplace - Plugins",
239
+ "admin.pages.MarketPlacePage.illustration": "marketplace illustration",
240
+ "admin.pages.MarketPlacePage.market.link": "Visit the web marketplace",
241
+ "admin.pages.MarketPlacePage.published": "Finally here.",
242
+ "admin.pages.MarketPlacePage.submit.plugin.link": "Submit your plugin",
243
+ "admin.pages.MarketPlacePage.subtitle": "Get more out of Strapi",
244
+ "admin.pages.MarketPlacePage.title": "Marketplace",
245
245
  "anErrorOccurred": "Woops! Something went wrong. Please, try again.",
246
246
  "app.components.GuidedTour.skip": "Skip the tour",
247
247
  "app.components.GuidedTour.title": "3 steps to get started",
@@ -704,4 +704,4 @@
704
704
  "request.error.model.unknown": "This model doesn't exist",
705
705
  "skipToContent": "Skip to content",
706
706
  "submit": "Submit"
707
- }
707
+ }
Binary file