Skip to content

Commit

Permalink
Update variable/function names in connect banner
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeyGuyDylan committed Oct 29, 2024
1 parent b97f446 commit b33d9c7
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getRedirectUri = () => {
};

const ConnectBanner: FC< ConnectBannerProps > = ( { block, explanation = null } ) => {
const [ isRedirecting, setIsRedirecting ] = useState( false );
const [ isReadyToRedirect, setIsReadyToRedirect ] = useState( false );
const [ isSaving, setIsSaving ] = useState( false );
const { handleConnectUser } = useConnection( {
from: 'editor',
Expand All @@ -38,11 +38,11 @@ const ConnectBanner: FC< ConnectBannerProps > = ( { block, explanation = null }
const { autosave } = useAutosaveAndRedirect();
const { tracks } = useAnalytics();

const goToCheckoutPage = ( event: MouseEvent< HTMLButtonElement > ) => {
const goToConnectPage = ( event: MouseEvent< HTMLButtonElement > ) => {
setIsSaving( true );
autosave( event ).then( () => {
tracks.recordEvent( 'jetpack_editor_connect_banner_click', { block } );
setIsRedirecting( true );
setIsReadyToRedirect( true );
setIsSaving( false );
} );
};
Expand All @@ -51,20 +51,20 @@ const ConnectBanner: FC< ConnectBannerProps > = ( { block, explanation = null }
// The redirection is handled this way to ensure we get the right redirectUri
// In the case that the post is new and unsaved, the component requires a re-render
// in order to get the correct URI when the handler is called.
if ( isRedirecting ) {
if ( isReadyToRedirect ) {
handleConnectUser();
}
}, [ isRedirecting, handleConnectUser ] );
}, [ isReadyToRedirect, handleConnectUser ] );

return (
<div>
<Nudge
buttonText={ __( 'Connect Jetpack', 'jetpack' ) }
className="jetpack-connect-banner-nudge"
description={ __( 'Your account is not connected to Jetpack at the moment.', 'jetpack' ) }
goToCheckoutPage={ goToCheckoutPage }
goToCheckoutPage={ goToConnectPage }
checkoutUrl={ '#' }
isRedirecting={ isRedirecting || isSaving }
isRedirecting={ isReadyToRedirect || isSaving }
/>
<div className="jetpack-connect-banner">
{ explanation && (
Expand Down

0 comments on commit b33d9c7

Please sign in to comment.