Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect: Hide Scan Report When No Data #40619

Merged
27 changes: 16 additions & 11 deletions projects/plugins/protect/src/js/routes/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AdminSection, Container, Col, ScanReport } from '@automattic/jetpack-components';
import { useMemo } from 'react';
import AdminPage from '../../components/admin-page';
import { SCAN_IN_PROGRESS_STATUSES } from '../../constants';
import useScanStatusQuery from '../../data/scan/use-scan-status-query';
import HomeAdminSectionHero from './home-admin-section-hero';
import styles from './styles.module.scss';
Expand Down Expand Up @@ -33,20 +34,24 @@
[ status ]
);

const showReport = !! status.lastChecked || SCAN_IN_PROGRESS_STATUSES.indexOf( status?.status ) >= 0;

Check failure on line 37 in projects/plugins/protect/src/js/routes/home/index.jsx

View workflow job for this annotation

GitHub Actions / ESLint (non-excluded files only)

Replace `·` with `⏎↹↹`

return (
<AdminPage>
<HomeAdminSectionHero />
<AdminSection>
<Container
className={ styles[ 'scan-report-container' ] }
horizontalSpacing={ 5 }
horizontalGap={ 4 }
>
<Col>
<ScanReport dataSource={ status.dataSource } data={ data } />
</Col>
</Container>
</AdminSection>
{ showReport && (
<AdminSection>
<Container
className={ styles[ 'scan-report-container' ] }
horizontalSpacing={ 5 }
horizontalGap={ 4 }
>
<Col>
<ScanReport dataSource={ status.dataSource } data={ data } />
</Col>
</Container>
</AdminSection>
) }
</AdminPage>
);
};
Expand Down
Loading