Skip to content

Commit

Permalink
Protect: Hide Scan Report When No Data (#40619)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller authored Dec 18, 2024
1 parent 1404d24 commit 2c38d55
Showing 1 changed file with 16 additions and 11 deletions.
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 @@ const HomePage = () => {
[ status ]
);

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

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

0 comments on commit 2c38d55

Please sign in to comment.