| @@ -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(() => |