-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix blogroll block unhelpful error when user not connected (#39638)
* Add connection nudge to blogroll block * changelog * Update connection banner to show if current user is not connected
- Loading branch information
1 parent
39c053b
commit 3584d37
Showing
9 changed files
with
120 additions
and
81 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ects/plugins/jetpack/changelog/fix-blogroll-block-unhelpful-error-when-user-not-connected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: other | ||
|
||
Show connection nudge instead of error if user is not connected on blogroll block |
35 changes: 0 additions & 35 deletions
35
projects/plugins/jetpack/extensions/blocks/ai-assistant/components/connect-prompt/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
projects/plugins/jetpack/extensions/blocks/ai-chat/components/nudge-connect/index.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
projects/plugins/jetpack/extensions/shared/components/connect-banner/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
/* | ||
* Internal dependencies | ||
*/ | ||
import useAutosaveAndRedirect from '../../use-autosave-and-redirect'; | ||
import { Nudge } from '../upgrade-nudge'; | ||
import type { MouseEvent, FC } from 'react'; | ||
|
||
interface ConnectBannerProps { | ||
explanation?: string; | ||
} | ||
|
||
import './style.scss'; | ||
|
||
const ConnectBanner: FC< ConnectBannerProps > = ( { explanation = null } ) => { | ||
const checkoutUrl = `${ window?.Jetpack_Editor_Initial_State?.adminUrl }admin.php?page=my-jetpack#/connection`; | ||
const { autosaveAndRedirect, isRedirecting } = useAutosaveAndRedirect( checkoutUrl ); | ||
|
||
const goToCheckoutPage = ( event: MouseEvent< HTMLButtonElement > ) => { | ||
autosaveAndRedirect( event ); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Nudge | ||
buttonText={ __( 'Connect Jetpack', 'jetpack' ) } | ||
checkoutUrl={ checkoutUrl } | ||
className="jetpack-connect-banner-nudge" | ||
description={ __( 'Your account is not connected to Jetpack at the moment.', 'jetpack' ) } | ||
goToCheckoutPage={ goToCheckoutPage } | ||
isRedirecting={ isRedirecting } | ||
/> | ||
<div className="jetpack-connect-banner"> | ||
{ explanation && ( | ||
<div className="jetpack-connect-banner__explanation"> | ||
<p>{ explanation }</p> | ||
</div> | ||
) } | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ConnectBanner; |
45 changes: 45 additions & 0 deletions
45
projects/plugins/jetpack/extensions/shared/components/connect-banner/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@import '@automattic/jetpack-base-styles/style'; | ||
|
||
.jetpack-connect-banner-nudge { | ||
.jetpack-upgrade-plan-banner__wrapper { | ||
flex-wrap: nowrap; | ||
|
||
&__description { | ||
line-height: 24px; | ||
} | ||
|
||
.components-button.is-primary { | ||
background-color: var( --jp-white ); | ||
color: var( --jp-black ); | ||
margin-top: 8px; | ||
margin-bottom: 8px; | ||
|
||
&:hover { | ||
background-color: var( --jp-gray-0 ); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.jetpack-connect-banner { | ||
color: var( --jp-black-80 ); | ||
background-color: var( --jp-white ); | ||
box-shadow: 0px 12px 15px 0px rgba(0, 0, 0, 0.12), 0px 3px 9px 0px rgba(0, 0, 0, 0.12), 0px 1px 3px 0px rgba(0, 0, 0, 0.15); | ||
border-radius: 0 0 2px 2px; | ||
|
||
&__explanation { | ||
display: flex; | ||
padding: 8px 8px 8px 12px; | ||
align-items: flex-end; | ||
box-sizing: border-box; | ||
border-radius: 6px 6px 0 0; | ||
gap: 6px; | ||
|
||
p { | ||
color: var( --jp-gray-20 ); | ||
font-size: var( --font-label ); | ||
padding: 6px 8px; | ||
margin: 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters