diff --git a/assets/dev/js/admin/hello-admin.js b/assets/dev/js/admin/hello-admin.js index 9769c291..d800f1eb 100644 --- a/assets/dev/js/admin/hello-admin.js +++ b/assets/dev/js/admin/hello-admin.js @@ -1,9 +1,9 @@ import './hello-admin.scss'; import { render } from '@wordpress/element'; -import { MainPage } from './pages/main-page.js'; +import { SettingsPage } from './pages/settings-page.js'; const App = () => { - return ; + return ; }; document.addEventListener( 'DOMContentLoaded', () => { diff --git a/assets/dev/js/admin/pages/panels/head-cleanup.js b/assets/dev/js/admin/pages/panels/head-cleanup.js deleted file mode 100644 index fac3d3ef..00000000 --- a/assets/dev/js/admin/pages/panels/head-cleanup.js +++ /dev/null @@ -1,88 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { SETTINGS } from '../settings.js'; -import { PanelBody, ToggleControl } from '@wordpress/components'; - -export const PanelHeadCleanup = ( { settingsData, updateSettings } ) => { - const protocol = window.location.protocol || 'https:'; - const hostname = window.location.hostname || 'example.com'; - const prefix = protocol + '//' + hostname; - - return ( - - - updateSettings( SETTINGS.GENERATOR, value ) } - /> - <meta name="generator" content="WordPress x.x.x" /> - - updateSettings( SETTINGS.SHORTLINK, value ) } - /> - <link rel="shortlink" href="{ prefix }/?p=1" /> - - updateSettings( SETTINGS.WLW, value ) } - /> - <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="{ prefix }/wp-includes/wlwmanifest.xml" /> - - updateSettings( SETTINGS.RSD, value ) } - /> - <link rel="EditURI" type="application/rsd+xml" title="RSD" href="{ prefix }/xmlrpc.php?rsd" /> - - updateSettings( SETTINGS.OEMBED, value ) } - /> - <link rel="alternate" type="application/json+oembed" href="{ prefix }/wp-json/oembed/1.0/embed?url=..." /> - - updateSettings( SETTINGS.POST_PREV_NEXT, value ) } - /> - <link rel="next" title="Next Post" href="{ prefix }/..." /> - <link rel="prev" title="Previous Post" href="{ prefix }/..." /> - - updateSettings( SETTINGS.SITE_RSS, value ) } - /> - <link rel="alternate" type="application/rss+xml" href="{ prefix }/feed/" /> - - updateSettings( SETTINGS.COMMENTS_RSS, value ) } - /> - <link rel="alternate" type="application/rss+xml" href="{ prefix }/comments/feed/" /> - - updateSettings( SETTINGS.POST_COMMENTS_RSS, value ) } - /> - <link rel="alternate" type="application/rss+xml" href="{ prefix }/post-name/feed/" /> - - - ); -}; diff --git a/assets/dev/js/admin/pages/panels/scripts-styles.js b/assets/dev/js/admin/pages/panels/scripts-styles.js deleted file mode 100644 index f802707e..00000000 --- a/assets/dev/js/admin/pages/panels/scripts-styles.js +++ /dev/null @@ -1,67 +0,0 @@ -import { __ } from '@wordpress/i18n'; -import { SETTINGS } from '../settings.js'; -import { PanelBody, ToggleControl, Notice, Dashicon } from '@wordpress/components'; - -export const PanelScriptsStyles = ( { settingsData, updateSettings } ) => { - const protocol = window.location.protocol || 'https:'; - const hostname = window.location.hostname || 'example.com'; - const prefix = protocol + '//' + hostname; - - return ( - - - - - { __( 'Be cautious, disabling some of the following options may break your website.', 'hello-elementor' ) } - - - updateSettings( SETTINGS.EMOJI, value ) } - /> - - updateSettings( SETTINGS.WP_EMBED_SCRIPT, value ) } - /> - <script type="text/javascript" src="{ prefix }/wp-includes/js/wp-embed.min.js" /> - - updateSettings( SETTINGS.CLASSIC_THEME_STYLES, value ) } - /> - <link rel="stylesheet" href="{ prefix }/wp-includes/css/classic-themes.min.css" /> - - updateSettings( SETTINGS.GUTENBERG, value ) } - /> - <link rel="stylesheet" href="{ prefix }/wp-includes/css/dist/block-library/style.css" /> - - updateSettings( SETTINGS.HELLO_STYLE, value ) } - /> - <link rel="stylesheet" href="{ prefix }/wp-content/themes/hello-elementor/style.min.css" /> - - updateSettings( SETTINGS.HELLO_THEME, value ) } - /> - <link rel="stylesheet" href="{ prefix }/wp-content/themes/hello-elementor/theme.min.css" /> - - - ); -}; diff --git a/assets/dev/js/admin/pages/main-page.js b/assets/dev/js/admin/pages/settings-page.js similarity index 85% rename from assets/dev/js/admin/pages/main-page.js rename to assets/dev/js/admin/pages/settings-page.js index de8cae0f..f61fd20d 100644 --- a/assets/dev/js/admin/pages/main-page.js +++ b/assets/dev/js/admin/pages/settings-page.js @@ -4,10 +4,7 @@ import { dispatch, useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import api from '@wordpress/api'; import { Button, Panel, Placeholder, Spinner, SnackbarList } from '@wordpress/components'; -import { SETTINGS } from './settings.js'; -import { PanelThemeFeatures } from './panels/theme-features.js'; -import { PanelHeadCleanup } from './panels/head-cleanup.js'; -import { PanelScriptsStyles } from './panels/scripts-styles.js'; +import { SettingsPanel } from './../panels/settings-panel.js'; const Notices = () => { const notices = useSelect( @@ -29,7 +26,15 @@ const Notices = () => { ); }; -export const MainPage = () => { +const SETTINGS = { + DESCRIPTION_META_TAG: '_description_meta_tag', + SKIP_LINK: '_skip_link', + PAGE_TITLE: '_page_title', + HELLO_STYLE: '_hello_style', + HELLO_THEME: '_hello_theme', +}; + +export const SettingsPage = () => { const [ hasLoaded, setHasLoaded ] = useState( false ); const [ settingsData, setSettingsData ] = useState( {} ); @@ -115,11 +120,7 @@ export const MainPage = () => {
- - - - - +