2023-01-27 16:14:50 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import GridiconCheckmarkCircle from 'gridicons/dist/checkmark-circle';
|
|
|
|
import GridiconSync from 'gridicons/dist/sync';
|
|
|
|
import GridiconNotice from 'gridicons/dist/notice';
|
2024-05-31 03:49:36 +00:00
|
|
|
import clsx from 'clsx';
|
2023-01-27 16:14:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { SyncStatusType } from '~/marketing/types';
|
|
|
|
import { iconSize } from './iconSize';
|
|
|
|
import './SyncStatus.scss';
|
|
|
|
|
|
|
|
type SyncStatusPropsType = {
|
|
|
|
status: SyncStatusType;
|
|
|
|
};
|
|
|
|
|
|
|
|
const className = 'woocommerce-marketing-sync-status';
|
|
|
|
|
|
|
|
export const SyncStatus: React.FC< SyncStatusPropsType > = ( { status } ) => {
|
|
|
|
if ( status === 'failed' ) {
|
|
|
|
return (
|
2024-05-31 03:49:36 +00:00
|
|
|
<div className={ clsx( className, `${ className }__failed` ) }>
|
2023-01-27 16:14:50 +00:00
|
|
|
<GridiconNotice size={ iconSize } />
|
|
|
|
{ __( 'Sync failed', 'woocommerce' ) }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( status === 'syncing' ) {
|
|
|
|
return (
|
2024-05-31 03:49:36 +00:00
|
|
|
<div className={ clsx( className, `${ className }__syncing` ) }>
|
2023-01-27 16:14:50 +00:00
|
|
|
<GridiconSync size={ iconSize } />
|
|
|
|
{ __( 'Syncing', 'woocommerce' ) }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-05-31 03:49:36 +00:00
|
|
|
<div className={ clsx( className, `${ className }__synced` ) }>
|
2023-01-27 16:14:50 +00:00
|
|
|
<GridiconCheckmarkCircle size={ iconSize } />
|
|
|
|
{ __( 'Synced', 'woocommerce' ) }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|