-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ThreatModal: Add user connection gate (#40204)
* Add user connection gate * Fix stories * ThreatModal: Add credentials gate (#40205) * Add credentials gate * Fix stories * Fix credentials type * Fix build issues, and add early returns for gates
- Loading branch information
Showing
4 changed files
with
295 additions
and
46 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
projects/js-packages/components/components/threat-modal/credentials-gate.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,65 @@ | ||
import { Text, Button } from '@automattic/jetpack-components'; | ||
import { Notice } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import React, { ReactElement } from 'react'; | ||
import styles from './styles.module.scss'; | ||
|
||
const CredentialsGate = ( { | ||
siteCredentialsNeeded, | ||
credentialsIsFetching, | ||
credentialsRedirectUrl, | ||
children, | ||
}: { | ||
siteCredentialsNeeded: boolean; | ||
credentialsIsFetching: boolean; | ||
credentialsRedirectUrl: string; | ||
children: ReactElement; | ||
} ): JSX.Element => { | ||
if ( ! siteCredentialsNeeded ) { | ||
return children; | ||
} | ||
|
||
return ( | ||
<> | ||
<Notice | ||
status="warning" | ||
isDismissible={ false } | ||
children={ | ||
<Text> | ||
{ __( | ||
'Before Jetpack can auto-fix threats on your site, it needs your server credentials.', | ||
'jetpack' | ||
) } | ||
</Text> | ||
} | ||
/> | ||
|
||
<Text> | ||
{ __( | ||
'Your server credentials allow Jetpack to access the server that’s powering your website. This information is securely saved and only used to perform fix threats detected on your site.', | ||
'jetpack' | ||
) } | ||
</Text> | ||
|
||
<Text> | ||
{ __( | ||
'Once you’ve entered server credentials, Jetpack will be fixing the selected threats.', | ||
'jetpack' | ||
) } | ||
</Text> | ||
|
||
<div className={ styles[ 'modal-actions' ] }> | ||
<Button | ||
isExternalLink={ true } | ||
weight="regular" | ||
href={ credentialsRedirectUrl } | ||
isLoading={ credentialsIsFetching } | ||
> | ||
{ __( 'Enter server credentials', 'jetpack' ) } | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default CredentialsGate; |
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
Oops, something went wrong.