/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { FunctionComponent } from 'react';
import { Box, Typography, Pagination, CircularProgress } from '@mui/material';
import { ScanCard } from '../scan-card';
import { SearchToolbar, CountsToolbar } from '../toolbars';
import { AutoRefresh } from '../common';
import { useScansTab } from '../../../hooks/scan-admin';
import { useTheme } from '@mui/material/styles';
/**
* Scans tab component that displays an overview of all extension scans.
* Uses the useScansTab hook to consume context.
*/
export const ScansTabContent: FunctionComponent = () => {
const theme = useTheme();
const {
scans,
isLoading,
lastRefreshed,
autoRefresh,
onAutoRefreshChange,
counts,
search,
globalFilters,
statusFilters,
pagination,
} = useScansTab();
return (
<>
{isLoading ? (
) : scans.length === 0 ? (
No scans found
{search.hasActiveSearch ? 'Try adjusting your search query' : 'Running and completed scans will appear here'}
) : (
scans.map((scan) => (
))
)}
{pagination.totalPages > 1 && (
pagination.goToPage(page - 1)}
disabled={isLoading}
color='secondary'
size='large'
showFirstButton
showLastButton
/>
)}
>
);
};