import { __, sprintf } from '@wordpress/i18n'; import type { JSX } from 'react'; import type { Settings } from '../../shared/api/types/settings'; import type { Status } from '../../shared/api/types/status'; import { ResponseMeter } from '../../shared/database/ResponseMeter'; import { formatBytes, formatNumber } from '../../shared/lib/numbers'; import { millisecondsPhrase } from '../../shared/text/countedPhrases'; import { Icon } from '../../shared/ui/Icon'; import { DatabaseLimits } from './DatabaseLimits'; import { protections } from './protections'; type DatabaseProtectionProps = { database: Status[ 'database' ]; limits: Settings[ 'database' ] | undefined; }; export function DatabaseProtection( { database, limits, }: DatabaseProtectionProps ): JSX.Element { return (
{ __( 'Database response time now', 'aiplaz-link-checkup' ) } { millisecondsPhrase( database.response_ms ) }
{ limits !== undefined && }
{ __( 'Plugin data', 'aiplaz-link-checkup' ) } { formatBytes( database.size_bytes ) }{ ' ' } { sprintf( /* translators: %s: number of database tables */ __( 'in %s tables', 'aiplaz-link-checkup' ), formatNumber( database.tables ) ) }
); }