2019-05-07 07:18:48 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
2019-05-20 20:50:25 +00:00
|
|
|
import { isNil } from 'lodash';
|
2019-05-07 07:18:48 +00:00
|
|
|
|
|
|
|
function HistoricalDataProgress( { label, progress, total } ) {
|
2023-11-16 11:15:11 +00:00
|
|
|
/* translators: %s: label */
|
2022-03-30 09:00:04 +00:00
|
|
|
const labelText = sprintf( __( 'Imported %(label)s', 'woocommerce' ), {
|
|
|
|
label,
|
|
|
|
} );
|
2019-05-20 20:50:25 +00:00
|
|
|
|
2019-06-11 12:47:53 +00:00
|
|
|
const labelCounters = ! isNil( total )
|
2023-11-16 11:15:11 +00:00
|
|
|
? /* translators: 1: progress, 2: total */
|
|
|
|
sprintf( __( '%(progress)s of %(total)s', 'woocommerce' ), {
|
2019-06-11 12:47:53 +00:00
|
|
|
progress: progress || 0,
|
|
|
|
total,
|
2020-02-14 02:23:21 +00:00
|
|
|
} )
|
2019-06-11 12:47:53 +00:00
|
|
|
: null;
|
2019-05-20 20:50:25 +00:00
|
|
|
|
2019-05-07 07:18:48 +00:00
|
|
|
return (
|
|
|
|
<div className="woocommerce-settings-historical-data__progress">
|
2020-02-14 02:23:21 +00:00
|
|
|
<span className="woocommerce-settings-historical-data__progress-label">
|
|
|
|
{ labelText }
|
|
|
|
</span>
|
2019-05-20 20:50:25 +00:00
|
|
|
{ labelCounters && (
|
|
|
|
<span className="woocommerce-settings-historical-data__progress-label">
|
|
|
|
{ labelCounters }
|
|
|
|
</span>
|
|
|
|
) }
|
2019-05-07 07:18:48 +00:00
|
|
|
<progress
|
|
|
|
className="woocommerce-settings-historical-data__progress-bar"
|
|
|
|
max={ total }
|
2019-06-11 12:47:53 +00:00
|
|
|
value={ progress || 0 }
|
2019-05-07 07:18:48 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default HistoricalDataProgress;
|