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 } ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
const labelText = sprintf(
|
|
|
|
__( 'Imported %(label)s', 'woocommerce-admin' ),
|
|
|
|
{
|
|
|
|
label,
|
|
|
|
}
|
|
|
|
);
|
2019-05-20 20:50:25 +00:00
|
|
|
|
2019-06-11 12:47:53 +00:00
|
|
|
const labelCounters = ! isNil( total )
|
|
|
|
? sprintf( __( '%(progress)s of %(total)s', 'woocommerce-admin' ), {
|
|
|
|
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;
|