From 23dcbd80b27eb693384fa96b4498be11d9ccdb3a Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 9 Nov 2023 12:42:21 -0500 Subject: [PATCH] update coming soon component to new layout to pass test --- src/app/pages/settings/comingSoon.js | 41 +++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/app/pages/settings/comingSoon.js b/src/app/pages/settings/comingSoon.js index 0ea27da..e3d3668 100644 --- a/src/app/pages/settings/comingSoon.js +++ b/src/app/pages/settings/comingSoon.js @@ -10,17 +10,18 @@ import { SectionSettings } from "../../components/section"; import { useNotification } from '../../components/notifications/feed'; const ComingSoon = () => { - const { store, setStore } = useContext( AppStore ); - const [ comingSoon, setComingSoon ] = useState( store.comingSoon ); - const [ isError, setError ] = useState( false ); - + const { store, setStore } = useContext(AppStore); + const [comingSoon, setComingSoon] = useState(store.comingSoon); + const [isError, setError] = useState(false); + let notify = useNotification(); const getComingSoonNoticeTitle = () => { return comingSoon - ? __( 'Coming soon activated.', 'wp-plugin-mojo' ) - : __( 'Coming soon deactivated.', 'wp-plugin-mojo' ); + ? __('Coming soon activated', 'wp-plugin-mojo') + : __('Coming soon deactivated', 'wp-plugin-mojo'); }; + const getComingSoonNoticeText = () => { return comingSoon ? __( @@ -32,6 +33,20 @@ const ComingSoon = () => { 'wp-plugin-mojo' ); }; + + const getComingSoonSectionTitle = () => { + const getStatus = () => { + return ( + comingSoon + ? {__('Coming Soon', 'wp-plugin-mojo')} + : {__('Live', 'wp-plugin-mojo')} + ); + }; + + return ( + {__('Site Status', 'wp-plugin-mojo')}: {getStatus()} + ) + }; const toggleComingSoon = () => { mojoSettingsApiFetch({ comingSoon: !comingSoon }, setError, (response) => { @@ -52,7 +67,7 @@ const ComingSoon = () => { }); }; - useUpdateEffect( () => { + useUpdateEffect(() => { setStore({ ...store, comingSoon, @@ -60,19 +75,19 @@ const ComingSoon = () => { notifySuccess(); comingSoonAdminbarToggle(comingSoon); - }, [ comingSoon ] ); + }, [comingSoon]); return (
{
); -}; +} -export default ComingSoon; +export default ComingSoon; \ No newline at end of file