PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | js/components/ManageMenu/ManageMenu.tsx +6 -16 3.10.2 → 4.0.0-beta.2 View file →
@@ -2,12 +2,10 @@
2 2 import { __ } from '@wordpress/i18n'
3 3 import { createInterpolateElement } from '@wordpress/element'
4 4 import { fetchConstQueryParam, fetchQueryParam, updateQueryParams } from '../../utils/urls'
5 5 import { DismissibleNotice, type NoticeType } from '../common/Notice'
6 -import { SUBPAGES, Toolbar } from '../common/Toolbar'
7 -import { UpsellPage } from '../common/UpsellDialog'
8 -import { CommunityCloud } from './CommunityCloud/CommunityCloud'
9 -import { SnippetsTable } from './SnippetsTable'
6 +import { Toolbar } from '../common/Toolbar'
7 +import { SUBPAGES, SUBPAGE_ENTRIES, type SubpageName } from './subpages'
10 8
11 9 const repositionTableOptionsSettings = () => {
12 10 const screenOptionsForm = document.getElementById('adv-settings')
13 11 const tableOptions = screenOptionsForm?.querySelector<HTMLFieldSetElement>('fieldset.table-options-prefs')
@@ -39,9 +37,9 @@
39 37 }
40 38
41 39 case 'run-once-safe-mode':
42 40 return {
43 - text: __('Safe mode is active, so the snippet was not run.', 'code-snippets'),
41 + text: __('Snippet execution is disabled on this site, so the snippet was not run.', 'code-snippets'),
44 42 type: 'warning'
45 43 }
46 44
47 45 default:
@@ -68,23 +66,15 @@
68 66 : null
69 67 }
70 68
71 69 interface PageContentParams {
72 - subpage: typeof SUBPAGES[number]
70 + subpage: SubpageName
73 71 }
74 72
75 73 const PageContent: React.FC<PageContentParams> = ({ subpage }) => {
76 - switch (subpage) {
77 - case 'snippets':
78 - return <SnippetsTable />
74 + const { Component } = SUBPAGE_ENTRIES[subpage]
79 75
80 - case 'cloud-community':
81 - return <CommunityCloud />
82 -
83 - case 'blueprints':
84 - case 'cloud-library':
85 - return <UpsellPage />
86 - }
76 + return <Component />
87 77 }
88 78
89 79 export const ManageMenu = () => {
90 80 const subpage = useMemo(() =>