Back

80% Statements 4/5
87.5% Branches 7/8
100% Functions 2/2
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55              2x 1x                   2x       2x                                                                
import { __ } from '@wordpress/i18n';
import { shield } from '@wordpress/icons';
import { Link, Stack, Text } from '@wordpress/ui';
import { CardRow, ProtectCard } from '../../components/card';
import { recordEvent } from '../../data/analytics';
import type { ScanContext } from './types';
 
const onGetScan = () =>
	recordEvent( 'jetpack_protect_scan_settings_get_scan_link_click', { use_beacon: true } );
 
/**
 * The Settings tab's Scan card: Scan has nothing to set here, so it explains and links out.
 *
 * @param props       - The dashboard context.
 * @param props.state - The Scan section's state.
 * @return The card.
 */
export default function ScanSettingsCard( { state: scan }: ScanContext ) {
	Iif ( ! scan ) {
		return null;
	}
 
	return (
		<ProtectCard icon={ shield } title={ __( 'Scan', 'jetpack-protect-pkg' ) }>
			<CardRow>
				<Stack direction="column" gap="sm">
					<Text variant="body-md">
						{ scan.hasPlan
							? __(
									'Scan checks your site for malware every day. Threat alerts and scan settings are managed on Jetpack.com.',
									'jetpack-protect-pkg'
								)
							: __(
									'Your site is checked every day for known vulnerabilities in WordPress, plugins and themes. There’s nothing to set up.',
									'jetpack-protect-pkg'
								) }
					</Text>
					<Link
						href={ scan.url }
						openInNewTab={ scan.hasPlan }
						onClick={ scan.hasPlan ? undefined : onGetScan }
					>
						{ scan.hasPlan
							? __( 'Manage Scan settings', 'jetpack-protect-pkg' )
							: __(
									'Get Scan for daily malware scanning and one-click fixes',
									'jetpack-protect-pkg'
								) }
					</Link>
				</Stack>
			</CardRow>
		</ProtectCard>
	);
}