From 4275284bc270dfe815303db5de237e88b84a4790 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Tue, 3 Oct 2023 13:21:10 +0530 Subject: [PATCH 01/12] Insert Coming Soon checkbox --- .../CheckboxTemplate/CheckboxItem/index.js | 13 ++++++- .../CheckboxItem/stylesheet.scss | 16 ++++++++ .../components/ComingSoon/Index.js | 37 +++++++++++++++++++ .../components/ComingSoon/stylesheet.scss | 12 ++++++ src/OnboardingSPA/steps/SiteFeatures/index.js | 2 + src/OnboardingSPA/styles/app.scss | 1 + 6 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 src/OnboardingSPA/components/ComingSoon/Index.js create mode 100644 src/OnboardingSPA/components/ComingSoon/stylesheet.scss diff --git a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/index.js b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/index.js index 219154607..0198951f5 100644 --- a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/index.js +++ b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/index.js @@ -25,6 +25,7 @@ const CheckboxItem = ( { callback, tabIndex = 0, isSelectedDefault, + fullWidth = false, className = 'checkbox-item', } ) => { const [ showDescription, setShowDescription ] = useState( false ); @@ -44,7 +45,9 @@ const CheckboxItem = ( {
-
{ desc }
+
+ { desc } +
) }
diff --git a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss index f63bad775..9f29c3b44 100644 --- a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss +++ b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss @@ -13,6 +13,14 @@ width: clamp(15rem, 25vw, 35rem); box-shadow: 0 2px 8px 2px rgba(204, 204, 204, 0.175295); + &--full-width { + width: clamp(15rem, 53.5vw, 74rem); + + @media (max-width: #{ ($break-xlarge) }) { + width: clamp(15rem, 25vw, 35rem); + } + } + &-container { display: flex; align-items: center; @@ -125,5 +133,13 @@ border-right: 1px solid rgba(var(--nfd-onboarding-highlighted--rgb), 0.1); border-bottom: 1px solid rgba(var(--nfd-onboarding-highlighted--rgb), 0.1); box-shadow: 0 11px 8px -3px rgba(var(--nfd-onboarding-highlighted--rgb), 0.37); + + &--full-width { + width: clamp(15rem, 53.5vw, 74rem); + + @media (max-width: #{ ($break-xlarge) }) { + width: clamp(15rem, 25vw, 35rem); + } + } } } diff --git a/src/OnboardingSPA/components/ComingSoon/Index.js b/src/OnboardingSPA/components/ComingSoon/Index.js new file mode 100644 index 000000000..3afd6c2c0 --- /dev/null +++ b/src/OnboardingSPA/components/ComingSoon/Index.js @@ -0,0 +1,37 @@ +// import { useState } from '@wordpress/element'; +// import { useSelect, useDispatch } from '@wordpress/data'; + +import { CheckboxItem } from '../../components/CheckboxTemplate'; +// import { store as nfdOnboardingStore } from '../../store'; + +const ComingSoon = () => { + // const [ comingSoon, setComingSoon ] = useState(); + + // const { setCurrentOnboardingData } = useDispatch( nfdOnboardingStore ); + + // const { currentData } = useSelect( ( select ) => { + // return { + // currentData: + // select( nfdOnboardingStore ).getCurrentOnboardingData(), + // }; + // }, [] ); + + async function handleComingSoon() {} + + return ( +
+ +
+ ); +}; + +export default ComingSoon; diff --git a/src/OnboardingSPA/components/ComingSoon/stylesheet.scss b/src/OnboardingSPA/components/ComingSoon/stylesheet.scss new file mode 100644 index 000000000..570bc03e3 --- /dev/null +++ b/src/OnboardingSPA/components/ComingSoon/stylesheet.scss @@ -0,0 +1,12 @@ +.coming-soon { + + &--wrapper { + width: 100%; + display: flex; + justify-content: center; + + @media (max-width: #{ ($break-xlarge) }) { + justify-content: start; + } + } +} diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index 0bb792eef..229dbec08 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -12,6 +12,7 @@ import HeadingWithSubHeading from '../../components/HeadingWithSubHeading'; import CheckboxList from '../../components/CheckboxTemplate/CheckboxList'; import { CheckboxListSkeleton } from '../../components/CheckboxTemplate'; import getContents from './contents'; +import ComingSoon from '../../components/ComingSoon'; const StepSiteFeatures = () => { const isLargeViewport = useViewportMatch( 'medium' ); @@ -112,6 +113,7 @@ const StepSiteFeatures = () => { customItemsList={ customPluginsList } /> ) } + ); }; diff --git a/src/OnboardingSPA/styles/app.scss b/src/OnboardingSPA/styles/app.scss index 46be806fe..3a11d3311 100644 --- a/src/OnboardingSPA/styles/app.scss +++ b/src/OnboardingSPA/styles/app.scss @@ -42,6 +42,7 @@ @import "../components/NewfoldInterfaceSkeleton/style"; @import "../components/Loaders/Chapter/Interstitial/stylesheet"; @import "../components/Grid/stylesheet"; +@import "../components/ComingSoon/stylesheet"; // CSS for Pages @import "../steps/BasicInfo/stylesheet"; From b940afcacbe335f900bce829d77febf32699e58f Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Tue, 3 Oct 2023 17:47:26 +0530 Subject: [PATCH 02/12] Improvements Added Translations Added API Requests --- .../components/ComingSoon/Index.js | 39 ++++++++++--------- .../components/ComingSoon/contents.js | 27 +++++++++++++ src/OnboardingSPA/utils/api/comingSoon.js | 15 +++++++ 3 files changed, 63 insertions(+), 18 deletions(-) create mode 100644 src/OnboardingSPA/components/ComingSoon/contents.js create mode 100644 src/OnboardingSPA/utils/api/comingSoon.js diff --git a/src/OnboardingSPA/components/ComingSoon/Index.js b/src/OnboardingSPA/components/ComingSoon/Index.js index 3afd6c2c0..e3254cfc9 100644 --- a/src/OnboardingSPA/components/ComingSoon/Index.js +++ b/src/OnboardingSPA/components/ComingSoon/Index.js @@ -1,34 +1,37 @@ -// import { useState } from '@wordpress/element'; -// import { useSelect, useDispatch } from '@wordpress/data'; +import { useSelect, useDispatch } from '@wordpress/data'; -import { CheckboxItem } from '../../components/CheckboxTemplate'; -// import { store as nfdOnboardingStore } from '../../store'; +import getContents from './contents'; +import { CheckboxItem } from '../CheckboxTemplate'; +import { store as nfdOnboardingStore } from '../../store'; const ComingSoon = () => { - // const [ comingSoon, setComingSoon ] = useState(); + const content = getContents(); - // const { setCurrentOnboardingData } = useDispatch( nfdOnboardingStore ); + const { currentData } = useSelect( ( select ) => { + return { + currentData: + select( nfdOnboardingStore ).getCurrentOnboardingData(), + }; + }, [] ); - // const { currentData } = useSelect( ( select ) => { - // return { - // currentData: - // select( nfdOnboardingStore ).getCurrentOnboardingData(), - // }; - // }, [] ); + const { setCurrentOnboardingData } = useDispatch( nfdOnboardingStore ); - async function handleComingSoon() {} + async function handleComingSoon( name, selection ) { + currentData.data.comingSoon = selection; + setCurrentOnboardingData( currentData ); + } return (
); diff --git a/src/OnboardingSPA/components/ComingSoon/contents.js b/src/OnboardingSPA/components/ComingSoon/contents.js new file mode 100644 index 000000000..887bf22ed --- /dev/null +++ b/src/OnboardingSPA/components/ComingSoon/contents.js @@ -0,0 +1,27 @@ +import { __, sprintf } from '@wordpress/i18n'; + +import { translations } from '../../utils/locales/translations'; + +const getContents = () => { + return { + title: __( 'Coming Soon', 'wp-module-onboarding' ), + subtitle: sprintf( + /* translators: %s: site or store */ + __( + 'Keep your %s private until you click launch', + 'wp-module-onboarding' + ), + translations( 'site' ) + ), + desc: sprintf( + /* translators: %s: site or store */ + __( + 'Keep your %s private until you click launch', + 'wp-module-onboarding' + ), + translations( 'site' ) + ), + }; +}; + +export default getContents; diff --git a/src/OnboardingSPA/utils/api/comingSoon.js b/src/OnboardingSPA/utils/api/comingSoon.js new file mode 100644 index 000000000..12192d178 --- /dev/null +++ b/src/OnboardingSPA/utils/api/comingSoon.js @@ -0,0 +1,15 @@ +import { resolve } from './resolve'; +import { wpSiteUrl } from '../../../constants'; + +import apiFetch from '@wordpress/api-fetch'; + +export async function setComingSoonDashboard( comingSoon ) { + const data = { comingSoon }; + return await resolve( + apiFetch( { + url: wpSiteUrl + '/index.php?rest_route=/bluehost/v1/settings', + method: 'POST', + data, + } ).then() + ); +} From 0d51563c0680542e4d2f3ebf1baf32d49af3393c Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Tue, 3 Oct 2023 18:10:47 +0530 Subject: [PATCH 03/12] Test --- src/OnboardingSPA/components/ComingSoon/{Index.js => 1index.js} | 0 src/OnboardingSPA/steps/SiteFeatures/index.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/OnboardingSPA/components/ComingSoon/{Index.js => 1index.js} (100%) diff --git a/src/OnboardingSPA/components/ComingSoon/Index.js b/src/OnboardingSPA/components/ComingSoon/1index.js similarity index 100% rename from src/OnboardingSPA/components/ComingSoon/Index.js rename to src/OnboardingSPA/components/ComingSoon/1index.js diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index 229dbec08..a69ffba18 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -12,7 +12,7 @@ import HeadingWithSubHeading from '../../components/HeadingWithSubHeading'; import CheckboxList from '../../components/CheckboxTemplate/CheckboxList'; import { CheckboxListSkeleton } from '../../components/CheckboxTemplate'; import getContents from './contents'; -import ComingSoon from '../../components/ComingSoon'; +import ComingSoon from '../../components/ComingSoon/1index'; const StepSiteFeatures = () => { const isLargeViewport = useViewportMatch( 'medium' ); From 499bc638e7c1aa8c992e02589a67e1e4bb78269f Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Tue, 3 Oct 2023 18:11:16 +0530 Subject: [PATCH 04/12] Test 2 --- src/OnboardingSPA/components/ComingSoon/{1index.js => index.js} | 0 src/OnboardingSPA/steps/SiteFeatures/index.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/OnboardingSPA/components/ComingSoon/{1index.js => index.js} (100%) diff --git a/src/OnboardingSPA/components/ComingSoon/1index.js b/src/OnboardingSPA/components/ComingSoon/index.js similarity index 100% rename from src/OnboardingSPA/components/ComingSoon/1index.js rename to src/OnboardingSPA/components/ComingSoon/index.js diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index a69ffba18..229dbec08 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -12,7 +12,7 @@ import HeadingWithSubHeading from '../../components/HeadingWithSubHeading'; import CheckboxList from '../../components/CheckboxTemplate/CheckboxList'; import { CheckboxListSkeleton } from '../../components/CheckboxTemplate'; import getContents from './contents'; -import ComingSoon from '../../components/ComingSoon/1index'; +import ComingSoon from '../../components/ComingSoon'; const StepSiteFeatures = () => { const isLargeViewport = useViewportMatch( 'medium' ); From 416dfd08333160f5557e8947c0e9eb100cde38ca Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 4 Oct 2023 10:03:59 +0530 Subject: [PATCH 05/12] Set Coming Soon on exit --- .../components/ExitToWordPress/index.js | 2 ++ .../Loaders/Chapter/Interstitial/index.js | 2 ++ src/OnboardingSPA/steps/Complete/index.js | 25 +++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/OnboardingSPA/components/ExitToWordPress/index.js b/src/OnboardingSPA/components/ExitToWordPress/index.js index 4b36f6d6b..007a9be25 100644 --- a/src/OnboardingSPA/components/ExitToWordPress/index.js +++ b/src/OnboardingSPA/components/ExitToWordPress/index.js @@ -20,6 +20,7 @@ import { CATEGORY, } from '../../utils/analytics/hiive/constants'; import { activateInitialPlugins } from '../../utils/api/plugins'; +import { setComingSoonDashboard } from '../../utils/api/comingSoon'; /** * Self-contained button and confirmation modal for exiting Onboarding page. @@ -101,6 +102,7 @@ const ExitToWordPress = ( { } } setFlow( currentData ); + setComingSoonDashboard( currentData?.data?.comingSoon ); } activateInitialPlugins(); trackOnboardingEvent( diff --git a/src/OnboardingSPA/components/Loaders/Chapter/Interstitial/index.js b/src/OnboardingSPA/components/Loaders/Chapter/Interstitial/index.js index d59bc65bf..c30137d6e 100644 --- a/src/OnboardingSPA/components/Loaders/Chapter/Interstitial/index.js +++ b/src/OnboardingSPA/components/Loaders/Chapter/Interstitial/index.js @@ -18,6 +18,7 @@ import { import { pluginDashboardPage } from '../../../../../constants'; import { setFlow } from '../../../../utils/api/flow'; import { ACTION_ONBOARDING_COMPLETE } from '../../../../utils/analytics/hiive/constants'; +import { setComingSoonDashboard } from '../../../../utils/api/comingSoon'; const ChapterInterstitialLoader = () => { const [ countdown, setCountdown ] = useState( 15 ); @@ -29,6 +30,7 @@ const ChapterInterstitialLoader = () => { if ( currentData ) { currentData.isComplete = new Date().getTime(); setFlow( currentData ); + setComingSoonDashboard( currentData?.data?.comingSoon ); } activateInitialPlugins(); diff --git a/src/OnboardingSPA/steps/Complete/index.js b/src/OnboardingSPA/steps/Complete/index.js index 51f964852..3eda6b53a 100644 --- a/src/OnboardingSPA/steps/Complete/index.js +++ b/src/OnboardingSPA/steps/Complete/index.js @@ -9,6 +9,7 @@ import { StepLoader } from '../../components/Loaders'; import { StepErrorState } from '../../components/ErrorState'; import { THEME_STATUS_INIT } from '../../../constants'; import { DesignStateHandler } from '../../components/StateHandlers'; +import { setComingSoonDashboard } from '../../utils/api/comingSoon'; const StepComplete = () => { const { @@ -22,18 +23,26 @@ const StepComplete = () => { const navigate = useNavigate(); const [ isError, setIsError ] = useState( false ); - const { nextStep, brandName, isQueueEmpty } = useSelect( ( select ) => { - return { - nextStep: select( nfdOnboardingStore ).getNextStep(), - brandName: select( nfdOnboardingStore ).getNewfoldBrandName(), - isQueueEmpty: select( nfdOnboardingStore ).isQueueEmpty(), - }; - }, [] ); + const { nextStep, brandName, isQueueEmpty, currentData } = useSelect( + ( select ) => { + return { + nextStep: select( nfdOnboardingStore ).getNextStep(), + brandName: select( nfdOnboardingStore ).getNewfoldBrandName(), + isQueueEmpty: select( nfdOnboardingStore ).isQueueEmpty(), + currentData: + select( nfdOnboardingStore ).getCurrentOnboardingData(), + }; + }, + [] + ); const contents = getContents( brandName ); const checkFlowComplete = async () => { - await Promise.all( [ completeFlowRequest() ] ).then( ( values ) => + await Promise.all( [ + completeFlowRequest(), + setComingSoonDashboard( currentData?.data?.comingSoon ), + ] ).then( ( values ) => values.forEach( ( value ) => { // If any Request returns False then Show Error if ( ! value ) { From d254ffcb13131e27bc777e55cda1e66842be11e5 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 4 Oct 2023 10:14:00 +0530 Subject: [PATCH 06/12] Additions Added a wait to make appearance subtle Added a Specific Icon --- src/OnboardingSPA/components/ComingSoon/index.js | 2 +- src/OnboardingSPA/static/icons/site-features/comingsoon.svg | 3 +++ src/OnboardingSPA/steps/SiteFeatures/index.js | 2 +- src/OnboardingSPA/styles/_icons.scss | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/OnboardingSPA/static/icons/site-features/comingsoon.svg diff --git a/src/OnboardingSPA/components/ComingSoon/index.js b/src/OnboardingSPA/components/ComingSoon/index.js index e3254cfc9..4b559e5c9 100644 --- a/src/OnboardingSPA/components/ComingSoon/index.js +++ b/src/OnboardingSPA/components/ComingSoon/index.js @@ -27,7 +27,7 @@ const ComingSoon = () => { name="coming_soon" title={ content.title } subtitle={ content.subtitle } - icon={ '--site-features-security' } + icon={ '--site-features-comingsoon' } desc={ content.desc } callback={ handleComingSoon } fullWidth={ true } diff --git a/src/OnboardingSPA/static/icons/site-features/comingsoon.svg b/src/OnboardingSPA/static/icons/site-features/comingsoon.svg new file mode 100644 index 000000000..9fb2dd985 --- /dev/null +++ b/src/OnboardingSPA/static/icons/site-features/comingsoon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index 229dbec08..bed45caa6 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -113,7 +113,7 @@ const StepSiteFeatures = () => { customItemsList={ customPluginsList } /> ) } - + { customPluginsList && } ); }; diff --git a/src/OnboardingSPA/styles/_icons.scss b/src/OnboardingSPA/styles/_icons.scss index 909fd890e..31501c2a6 100644 --- a/src/OnboardingSPA/styles/_icons.scss +++ b/src/OnboardingSPA/styles/_icons.scss @@ -35,4 +35,5 @@ body { --site-features-security: url(../static/icons/site-features/security.svg); --site-features-share: url(../static/icons/site-features/share.svg); --site-features-wishlist: url(../static/icons/site-features/wishlist.svg); + --site-features-comingsoon: url(../static/icons/site-features/comingsoon.svg); } From cc7b8d06905105583081ab3b8a8b68b183af42dd Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 4 Oct 2023 15:23:55 +0530 Subject: [PATCH 07/12] Renaming Things --- src/OnboardingSPA/components/ComingSoon/index.js | 2 +- src/OnboardingSPA/components/ComingSoon/stylesheet.scss | 4 ++-- src/OnboardingSPA/components/ExitToWordPress/index.js | 4 ++-- .../components/Loaders/Chapter/Interstitial/index.js | 4 ++-- src/OnboardingSPA/steps/Complete/index.js | 4 ++-- src/OnboardingSPA/utils/api/comingSoon.js | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/OnboardingSPA/components/ComingSoon/index.js b/src/OnboardingSPA/components/ComingSoon/index.js index 4b559e5c9..5ec136ca4 100644 --- a/src/OnboardingSPA/components/ComingSoon/index.js +++ b/src/OnboardingSPA/components/ComingSoon/index.js @@ -22,7 +22,7 @@ const ComingSoon = () => { } return ( -
+
{ const [ countdown, setCountdown ] = useState( 15 ); @@ -30,7 +30,7 @@ const ChapterInterstitialLoader = () => { if ( currentData ) { currentData.isComplete = new Date().getTime(); setFlow( currentData ); - setComingSoonDashboard( currentData?.data?.comingSoon ); + setComingSoon( currentData?.data?.comingSoon ); } activateInitialPlugins(); diff --git a/src/OnboardingSPA/steps/Complete/index.js b/src/OnboardingSPA/steps/Complete/index.js index 3eda6b53a..bd0489fad 100644 --- a/src/OnboardingSPA/steps/Complete/index.js +++ b/src/OnboardingSPA/steps/Complete/index.js @@ -9,7 +9,7 @@ import { StepLoader } from '../../components/Loaders'; import { StepErrorState } from '../../components/ErrorState'; import { THEME_STATUS_INIT } from '../../../constants'; import { DesignStateHandler } from '../../components/StateHandlers'; -import { setComingSoonDashboard } from '../../utils/api/comingSoon'; +import { setComingSoon } from '../../utils/api/comingSoon'; const StepComplete = () => { const { @@ -41,7 +41,7 @@ const StepComplete = () => { const checkFlowComplete = async () => { await Promise.all( [ completeFlowRequest(), - setComingSoonDashboard( currentData?.data?.comingSoon ), + setComingSoon( currentData?.data?.comingSoon ), ] ).then( ( values ) => values.forEach( ( value ) => { // If any Request returns False then Show Error diff --git a/src/OnboardingSPA/utils/api/comingSoon.js b/src/OnboardingSPA/utils/api/comingSoon.js index 12192d178..7d66b0d05 100644 --- a/src/OnboardingSPA/utils/api/comingSoon.js +++ b/src/OnboardingSPA/utils/api/comingSoon.js @@ -3,7 +3,7 @@ import { wpSiteUrl } from '../../../constants'; import apiFetch from '@wordpress/api-fetch'; -export async function setComingSoonDashboard( comingSoon ) { +export async function setComingSoon( comingSoon ) { const data = { comingSoon }; return await resolve( apiFetch( { From f04abe7c6ca8c0a9e53e89b3778eb9f81d0eac56 Mon Sep 17 00:00:00 2001 From: David Ryan Date: Wed, 4 Oct 2023 15:21:19 -0700 Subject: [PATCH 08/12] Update description text --- src/OnboardingSPA/components/ComingSoon/contents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OnboardingSPA/components/ComingSoon/contents.js b/src/OnboardingSPA/components/ComingSoon/contents.js index 887bf22ed..fb161e1ec 100644 --- a/src/OnboardingSPA/components/ComingSoon/contents.js +++ b/src/OnboardingSPA/components/ComingSoon/contents.js @@ -16,7 +16,7 @@ const getContents = () => { desc: sprintf( /* translators: %s: site or store */ __( - 'Keep your %s private until you click launch', + "We'll show a placeholder page to logged-out visitors while you build your %s.", 'wp-module-onboarding' ), translations( 'site' ) From ca95aba394fc0225f38d13f9b6dbe89f6b78c48c Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 6 Oct 2023 13:46:15 +0530 Subject: [PATCH 09/12] Change endpoint to own backend. --- includes/RestApi/SettingsController.php | 43 +++++++++++++++++++++++ src/OnboardingSPA/utils/api/comingSoon.js | 9 ++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/includes/RestApi/SettingsController.php b/includes/RestApi/SettingsController.php index a59456c11..68aca0ac6 100644 --- a/includes/RestApi/SettingsController.php +++ b/includes/RestApi/SettingsController.php @@ -112,6 +112,49 @@ public function register_routes() { ), ) ); + + \register_rest_route( + $this->namespace, + $this->rest_base . '/coming-soon', + array( + array( + 'methods' => \WP_REST_Server::CREATABLE, + 'callback' => array( $this, 'set_coming_soon' ), + 'permission_callback' => array( Permissions::class, 'rest_is_authorized_admin' ), + 'args' => $this->set_coming_soon_params(), + ), + ) + ); + } + + /** + * Set query params for coming soon route. + * + * @return array + */ + public function set_coming_soon_params() { + return array( + 'comingSoon' => array( + 'type' => 'boolean', + 'required' => true, + ), + ); + } + /** + * Endpoint to set Coming Soon for a website. + * + * @param \WP_REST_Request $request Request model. + * + * @return \WP_REST_Response|\WP_Error + */ + public function set_coming_soon( \WP_REST_Request $request ) { + + $new_value = ( $request->get_param( 'comingSoon' ) ) ? 'true' : 'false'; + update_option( 'nfd_coming_soon', $new_value ); + return new \WP_REST_Response( + array(), + 200 + ); } /** diff --git a/src/OnboardingSPA/utils/api/comingSoon.js b/src/OnboardingSPA/utils/api/comingSoon.js index 7d66b0d05..4c1d13b73 100644 --- a/src/OnboardingSPA/utils/api/comingSoon.js +++ b/src/OnboardingSPA/utils/api/comingSoon.js @@ -1,15 +1,16 @@ +import { onboardingRestURL } from './common'; import { resolve } from './resolve'; -import { wpSiteUrl } from '../../../constants'; import apiFetch from '@wordpress/api-fetch'; export async function setComingSoon( comingSoon ) { - const data = { comingSoon }; return await resolve( apiFetch( { - url: wpSiteUrl + '/index.php?rest_route=/bluehost/v1/settings', + url: onboardingRestURL( 'settings/coming-soon' ), method: 'POST', - data, + data: { + comingSoon, + }, } ).then() ); } From 834e91de15e10cab8b523b53cf3b4558255c7abf Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 6 Oct 2023 13:59:19 +0530 Subject: [PATCH 10/12] Update Styling --- .../CheckboxItem/stylesheet.scss | 4 +-- .../CheckboxList/stylesheet.scss | 28 ++++++++++--------- .../components/ComingSoon/stylesheet.scss | 4 --- src/OnboardingSPA/steps/SiteFeatures/index.js | 2 +- .../steps/SiteFeatures/stylesheet.scss | 7 +++++ src/OnboardingSPA/styles/app.scss | 1 + 6 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss diff --git a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss index 9f29c3b44..1ad7d0281 100644 --- a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss +++ b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxItem/stylesheet.scss @@ -16,7 +16,7 @@ &--full-width { width: clamp(15rem, 53.5vw, 74rem); - @media (max-width: #{ ($break-xlarge) }) { + @media (max-width: #{ ($break-medium) }) { width: clamp(15rem, 25vw, 35rem); } } @@ -137,7 +137,7 @@ &--full-width { width: clamp(15rem, 53.5vw, 74rem); - @media (max-width: #{ ($break-xlarge) }) { + @media (max-width: #{ ($break-medium) }) { width: clamp(15rem, 25vw, 35rem); } } diff --git a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxList/stylesheet.scss b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxList/stylesheet.scss index dd42eaf97..8a2c84037 100644 --- a/src/OnboardingSPA/components/CheckboxTemplate/CheckboxList/stylesheet.scss +++ b/src/OnboardingSPA/components/CheckboxTemplate/CheckboxList/stylesheet.scss @@ -1,16 +1,18 @@ .checkbox-list { - display: flex; - justify-content: center; - align-items: flex-start; + display: flex; + justify-content: center; + align-items: flex-start; - @media (max-width: #{ ($break-xlarge) }) { - flex-direction: column; - } + @media (max-width: #{ ($break-medium) }) { + flex-direction: column; + justify-content: center; + align-items: center; + } - &-col { - display: flex; - align-items: center; - flex-direction: column; - justify-content: center; - } -} \ No newline at end of file + &-col { + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + } +} diff --git a/src/OnboardingSPA/components/ComingSoon/stylesheet.scss b/src/OnboardingSPA/components/ComingSoon/stylesheet.scss index b8749c608..2862abd27 100644 --- a/src/OnboardingSPA/components/ComingSoon/stylesheet.scss +++ b/src/OnboardingSPA/components/ComingSoon/stylesheet.scss @@ -4,9 +4,5 @@ width: 100%; display: flex; justify-content: center; - - @media (max-width: #{ ($break-xlarge) }) { - justify-content: start; - } } } diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index bed45caa6..b7fc1cee4 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -92,7 +92,7 @@ const StepSiteFeatures = () => { return ( -
+
Date: Fri, 6 Oct 2023 14:01:21 +0530 Subject: [PATCH 11/12] Fix Lint --- src/OnboardingSPA/steps/SiteFeatures/index.js | 2 +- src/OnboardingSPA/styles/app.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index b7fc1cee4..a8265e459 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -92,7 +92,7 @@ const StepSiteFeatures = () => { return ( -
+
Date: Fri, 6 Oct 2023 14:02:29 +0530 Subject: [PATCH 12/12] Update stylesheet.scss --- src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss b/src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss index 70c062e1a..fae8868d7 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss +++ b/src/OnboardingSPA/steps/SiteFeatures/stylesheet.scss @@ -1,7 +1,7 @@ .site-features__heading { - margin: 100px; + margin: 100px; - @media (max-width: #{ ($break-medium) }) { - margin: 0px; - } + @media (max-width: #{ ($break-medium) }) { + margin: 0; + } }