diff --git a/src/app/pages/settings/index.js b/src/app/pages/settings/index.js index 6ce82e6f9..88f30ad19 100644 --- a/src/app/pages/settings/index.js +++ b/src/app/pages/settings/index.js @@ -1,64 +1,64 @@ -import classNames from "classnames"; -import { Container, Page } from "@newfold/ui-component-library"; -import useContainerBlockIsTarget from "App/util/hooks/useContainerBlockTarget"; -import AutomaticUpdates from "./automaticUpdates"; -import CommentSettings from "./commentSettings"; -import ComingSoon from "./comingSoon"; -import ContentSettings from "./contentSettings"; -import SocialMediaAccounts from "./socialMediaAccounts"; +import classNames from 'classnames'; +import { Container, Page } from '@newfold/ui-component-library'; +import useContainerBlockIsTarget from 'App/util/hooks/useContainerBlockTarget'; +import AutomaticUpdates from './automaticUpdates'; +import CommentSettings from './commentSettings'; +import ComingSoon from './comingSoon'; +import ContentSettings from './contentSettings'; +import SocialMediaAccounts from './socialMediaAccounts'; const Settings = () => { - return ( - - - + return ( + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - ); + + + + + + ); }; export default Settings; diff --git a/src/app/pages/settings/socialMediaAccounts.js b/src/app/pages/settings/socialMediaAccounts.js index b1daa09dc..381c239d0 100644 --- a/src/app/pages/settings/socialMediaAccounts.js +++ b/src/app/pages/settings/socialMediaAccounts.js @@ -1,116 +1,126 @@ -import { Button, Container } from "@newfold/ui-component-library"; -import { useEffect, useState } from "react"; +import { Button, Container } from '@newfold/ui-component-library'; +import { useEffect, useState } from '@wordpress/element'; import { - FacebookConnectPluginView, - facebookConnectHelper, - getFacebookUserProfileDetails, -} from "@newfold-labs/wp-module-facebook"; + FacebookConnectPluginView, + facebookConnectHelper, + getFacebookUserProfileDetails, +} from '@newfold-labs/wp-module-facebook'; const SocialMediaAccounts = () => { - const [showModal, setShowModal] = useState(false); - const [fbLogin, setFbLogin] = useState(false); - const [loginInfo, setLoginInfo] = useState(); + const [ showModal, setShowModal ] = useState( false ); + const [ fbLogin, setFbLogin ] = useState( false ); + const [ loginInfo, setLoginInfo ] = useState(); + let input = false; - const getFbDetails = () => { - getFacebookUserProfileDetails().then((res) => { - setFbLogin(res === "token not found!" ? false : true); - if (Array.isArray(res)) setLoginInfo(res[0]); - else setLoginInfo(res); - }); - }; + const getFbDetails = () => { + getFacebookUserProfileDetails().then( ( res ) => { + setFbLogin( res === 'token not found!' ? false : true ); + if ( Array.isArray( res ) ) setLoginInfo( res[ 0 ] ); + else setLoginInfo( res ); + } ); + }; - useEffect(() => { - getFbDetails(); - }, []); + useEffect( () => { + getFbDetails(); + }, [] ); - const handleFacebookConnect = () => { - facebookConnectHelper(getFbDetails).then(() => {}); - }; - let input = false; - return ( - -
-

- Click 'Add' to connect to one of your social media accounts. -

- -
- - {showModal && ( - <> -
{ - !input && setShowModal(false); - input = false; - }} - className=" nfd-justify-center nfd-items-center nfd-flex nfd-overflow-x-hidden nfd-overflow-y-auto nfd-fixed nfd-inset-0 nfd-z-50 nfd-outline-none nfd-focus:outline-none" - > -
-
-
-
-
- -
- (input = true)} - /> -
-
-
handleFacebookConnect()} - > - - - -

Facebook

-
-
-
-
-
- - )} -
- ); + const handleCloseModel = () => { + if ( ! input ) { + setShowModal( false ); + } + input = false; + }; + + const handleFacebookConnect = () => { + facebookConnectHelper( getFbDetails ).then( () => {} ); + }; + return ( + +
+

+ { __( + "Click 'Add' to connect to one of your social media accounts.", + 'wp-plugin-bluehost' + ) } +

+ +
+ + { showModal && ( + <> + + + + +
+ + ) } +
+ ); }; export default SocialMediaAccounts;