Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4c95bfe
Init project branch
nateweller Nov 14, 2024
91ce2ed
Protect: Refactor AdminSectionHero (#40516)
nateweller Dec 9, 2024
35cd0cf
Restore history header
dkmyta Dec 10, 2024
5ad53b7
Pass status filter presets to consumer
dkmyta Dec 10, 2024
e21bb59
Restore early return
dkmyta Dec 10, 2024
50a5849
Add plan level restrictions
dkmyta Dec 10, 2024
d738a65
Init project branch
nateweller Nov 14, 2024
b93cfa2
Protect: Integrate ThreatsDataViews Component (#40076)
nateweller Dec 5, 2024
19bc943
Separate scan and history DataViews
dkmyta Jan 3, 2025
561ab57
Reapply history routes
dkmyta Jan 3, 2025
13ec8a0
Add filters
dkmyta Jan 3, 2025
996649a
Add toggle group control
dkmyta Jan 3, 2025
5a0871e
Add historic flag
dkmyta Jan 3, 2025
939263c
Update stories
dkmyta Jan 3, 2025
a34d4bd
Remove unneeded filter handling
dkmyta Jan 3, 2025
84a2ebc
Revert unnecessary threats data views updates
dkmyta Jan 3, 2025
1d3733f
Fix import
dkmyta Jan 3, 2025
61ee84d
Include fixer action as label in list view action dropdown
dkmyta Jan 3, 2025
a847325
Add field constants
dkmyta Jan 3, 2025
23b791f
Reorg
dkmyta Jan 3, 2025
9cd5469
Add initialFields prop, update active to current where applicable
dkmyta Jan 6, 2025
ad201c2
Init project branch
nateweller Nov 14, 2024
8960ec6
Fix exports and imports
dkmyta Jan 7, 2025
ec33096
Move default values to function params
nateweller Jan 12, 2025
5ccae12
Fix ts warning
nateweller Jan 12, 2025
dcb2887
minor adjustment to definition of initial filters
nateweller Jan 12, 2025
c8cd20e
Add tsc-expect-error to dummy arg for minification cases
nateweller Jan 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Protect: Integrate ThreatsDataViews Component (#40076)
  • Loading branch information
nateweller committed Jan 12, 2025
commit b93cfa2a5881b90967d3cc77d8009f7c09a1fc02
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ import { Text, Button, useBreakpointMatch } from '@automattic/jetpack-components
import { Tooltip } from '@wordpress/components';
import { dateI18n } from '@wordpress/date';
import { __, _n, sprintf } from '@wordpress/i18n';
<<<<<<< HEAD
import clsx from 'clsx';
import { useCallback, useState, useMemo } from 'react';
=======
import { useCallback, useState } from 'react';
import { useMemo } from 'react';
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
import AdminSectionHero from '../../components/admin-section-hero';
import ErrorAdminSectionHero from '../../components/error-admin-section-hero';
import OnboardingPopover from '../../components/onboarding-popover';
Expand All @@ -16,7 +21,11 @@ import useWafData from '../../hooks/use-waf-data';
import ScanningAdminSectionHero from './scanning-admin-section-hero';
import styles from './styles.module.scss';

<<<<<<< HEAD
const ScanAdminSectionHero: React.FC = ( { size = 'normal' }: { size?: 'normal' | 'large' } ) => {
=======
const ScanAdminSectionHero: React.FC = () => {
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
const { recordEvent } = useAnalyticsTracks();
const { hasPlan, upgradePlan } = usePlan();
const { setModal } = useModal();
Expand Down Expand Up @@ -57,6 +66,7 @@ const ScanAdminSectionHero: React.FC = ( { size = 'normal' }: { size?: 'normal'
if ( status.lastChecked ) {
// Convert the lastChecked UTC date to a local timestamp
lastCheckedLocalTimestamp = new Date( status.lastChecked + ' UTC' ).getTime();
<<<<<<< HEAD
}

let heading = __( "Don't worry about a thing", 'jetpack-protect' );
Expand All @@ -79,6 +89,8 @@ const ScanAdminSectionHero: React.FC = ( { size = 'normal' }: { size?: 'normal'
numThreats
);
}
=======
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
}

const handleShowAutoFixersClick = threatList => {
Expand Down Expand Up @@ -136,6 +148,7 @@ const ScanAdminSectionHero: React.FC = ( { size = 'normal' }: { size?: 'normal'
'jetpack-protect'
) }
</Text>
<<<<<<< HEAD
) : (
<>
<Text mb={ 4 }>
Expand All @@ -146,6 +159,78 @@ const ScanAdminSectionHero: React.FC = ( { size = 'normal' }: { size?: 'normal'
'jetpack-protect'
),
totalVulnerabilitiesFormatted
=======
<OnboardingPopover
id={ hasPlan ? 'paid-daily-and-manual-scans' : 'free-daily-scans' }
position={ isSm ? 'bottom' : 'middle right' }
anchor={ dailyScansPopoverAnchor }
/>
<AdminSectionHero.Heading showIcon variant={ numThreats > 0 ? 'error' : 'success' }>
{ numThreats > 0
? sprintf(
/* translators: %s: Total number of threats/vulnerabilities */
__( '%1$s active %2$s', 'jetpack-protect' ),
numThreats,
hasPlan
? _n( 'threat', 'threats', numThreats, 'jetpack-protect' )
: _n( 'vulnerability', 'vulnerabilities', numThreats, 'jetpack-protect' )
)
: __( "Don't worry about a thing", 'jetpack-protect' ) }
</AdminSectionHero.Heading>
<AdminSectionHero.Subheading>
<>
{ hasPlan ? (
<Text>
{ __(
"We actively review your site's files line-by-line to identify threats and vulnerabilities.",
'jetpack-protect'
) }
</Text>
) : (
<>
<Text mb={ 4 }>
{ sprintf(
// translators: placeholder is the number of total vulnerabilities i.e. "22,000".
__(
'Every day we check your plugins, themes, and WordPress version against our %s listed vulnerabilities powered by WPScan, an Automattic brand.',
'jetpack-protect'
),
totalVulnerabilitiesFormatted
) }
</Text>
<Tooltip
text={ __(
'Upgrade Jetpack Protect to get access to advanced malware scanning with one-click fixes for most threats.',
'jetpack-protect'
) }
>
<Button onClick={ getScan }>
{ __( 'Upgrade to unlock malware scanning', 'jetpack-protect' ) }
</Button>
</Tooltip>
</>
) }
{ fixableList.length > 0 && (
<>
<div ref={ setShowAutoFixersPopoverAnchor }>
<Button
className={ styles[ 'auto-fixers' ] }
onClick={ handleShowAutoFixersClick( fixableList ) }
>
{ sprintf(
/* translators: Translates to Show auto fixers $s: Number of fixable threats. */
__( 'Show auto fixers (%s)', 'jetpack-protect' ),
fixableList.length
) }
</Button>
</div>
<OnboardingPopover
id="paid-fix-all-threats"
position={ isSm ? 'bottom right' : 'middle left' }
anchor={ showAutoFixersPopoverAnchor }
/>
</>
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
) }
</Text>
<Tooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const ScanningAdminSectionHero = ( { size = 'normal' }: { size?: 'normal' | 'lar
: totalVulnerabilities.toLocaleString();

return (
<<<<<<< HEAD
<AdminSectionHero>
<AdminSectionHero.Main
className={ clsx( styles[ 'hero-main' ], {
Expand Down Expand Up @@ -55,6 +56,46 @@ const ScanningAdminSectionHero = ( { size = 'normal' }: { size?: 'normal' | 'lar
<InProgressAnimation />
</AdminSectionHero.Aside>
</AdminSectionHero>
=======
<AdminSectionHero
main={
<>
<AdminSectionHero.Heading>
{ __( 'Your results will be ready soon', 'jetpack-protect' ) }
</AdminSectionHero.Heading>
<AdminSectionHero.Subheading>
<>
{ hasPlan && (
<ProgressBar
className={ styles.progress }
value={ status?.currentProgress }
total={ 100 }
/>
) }
<Text>
{ hasPlan
? __(
"Jetpack is actively scanning your site's files line-by-line to identify threats and vulnerabilities. This could take a minute or two.",
'jetpack-protect'
)
: sprintf(
// translators: placeholder is the number of total vulnerabilities i.e. "22,000".
__(
'We are scanning for security threats from our more than %s listed vulnerabilities, powered by WPScan. This could take a minute or two.',
'jetpack-protect'
),
totalVulnerabilitiesFormatted
) }
</Text>
</>
</AdminSectionHero.Subheading>
</>
}
secondary={ <InProgressAnimation /> }
preserveSecondaryOnMobile={ false }
spacing={ 4 }
/>
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
.hero-main {
max-width: 512px;
}
Expand All @@ -11,6 +12,10 @@
.auto-fixers {
margin-top: calc( var( --spacing-base ) * 4 ); // 32px
width: fit-content;
=======
.auto-fixers {
margin-top: calc( var( --spacing-base ) * 4 ); // 32px
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))
}

.scan-results-container {
Expand All @@ -23,6 +28,7 @@
margin-right: calc( var( --spacing-base ) * -3 ); // -24px
}
}
<<<<<<< HEAD

.progress-animation {
@media (max-width: 1099px) {
Expand All @@ -33,3 +39,5 @@
.last-checked {
width: fit-content;
}
=======
>>>>>>> 3d878c74bf (Protect: Integrate ThreatsDataViews Component (#40076))