import { __, sprintf } from '@wordpress/i18n'; import type { JSX } from 'react'; import type { Link } from '../../shared/api/types/links'; import { useNow } from '../../shared/lib/clock'; import { formatNumber } from '../../shared/lib/numbers'; import { LinkRow } from './LinkRow'; import { LinksPager } from './LinksPager'; import { LinksTableHead } from './LinksTableHead'; import type { LinkSelection } from './useLinkSelection'; const SLOW_REFRESH_MILLISECONDS = 30000; type LinksTableProps = { shownLinks: readonly Link[]; selection: LinkSelection; problemTotal: number; page: number; pageCount: number; }; export function LinksTable( { shownLinks, selection, problemTotal, page, pageCount, }: LinksTableProps ): JSX.Element { const now = useNow( SLOW_REFRESH_MILLISECONDS ); return ( <> { shownLinks.map( ( link ) => ( { selection.select( link.id, isSelected ); } } /> ) ) }
{ sprintf( /* translators: 1: number of links shown, 2: number of links that need attention */ __( 'Showing %1$s of %2$s', 'aiplaz-link-checkup' ), formatNumber( shownLinks.length ), formatNumber( problemTotal ) ) } { pageCount > 1 && ( ) }
); }