Skip to content

Commit

Permalink
Protect: only show Scan Report when scan is in progress or has result…
Browse files Browse the repository at this point in the history
…s to show
  • Loading branch information
nateweller committed Dec 15, 2024
1 parent 63cade7 commit 675f833
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions projects/plugins/protect/src/js/routes/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AdminSection, Container, Col, ScanReport } from '@automattic/jetpack-components';
import AdminPage from '../../components/admin-page';
import useScanStatusQuery from '../../data/scan/use-scan-status-query';
import useScanStatusQuery, { isScanInProgress } from '../../data/scan/use-scan-status-query';
import HomeAdminSectionHero from './home-admin-section-hero';
import styles from './styles.module.scss';

Expand All @@ -24,20 +24,24 @@ const HomePage = () => {
return { id: index + 1, ...item };
} );

const showReport = status.lastChecked || isScanInProgress( status );

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 675f833

Please sign in to comment.