import type { ReactNode } from 'react'; import { __, sprintf } from '@wordpress/i18n'; import { formatNumber } from '@/utils/formatting'; interface SearchQueriesProgressProps { children: ReactNode; readyDays: number; totalDays: number; className?: string; } /** * Shows determinate progress while Search Console dates are fetched in the * background. */ export const SearchQueriesProgress = ({ children, readyDays, totalDays, className = '' }: SearchQueriesProgressProps ) => { const boundedTotal = Math.max( 0, totalDays ); const boundedReady = Math.min( Math.max( 0, readyDays ), boundedTotal ); const progress = 0 < boundedTotal ? ( boundedReady / boundedTotal ) * 100 : 0; return (

{ children }

{0 < boundedTotal && (
) }
); };