Skip to content

Commit 8511198

Browse files
committed
Add loading state onto the UI of ProductFeedStatusSection component
1 parent 2afa78f commit 8511198

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

js/src/setup-mc/setup-stepper/setup-paid-ads/product-feed-status-section.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44
import { sprintf, __, _n } from '@wordpress/i18n';
55
import { useEffect } from '@wordpress/element';
66
import { Flex, FlexItem, FlexBlock } from '@wordpress/components';
7+
import { Spinner } from '@woocommerce/components';
78

89
/**
910
* Internal dependencies
1011
*/
1112
import Section from '.~/wcdl/section';
1213
import AppDocumentationLink from '.~/components/app-documentation-link';
13-
import SyncIcon from '.~/components/sync-icon';
14+
import SuccessIcon from '.~/components/success-icon';
1415
import AppTooltip from '.~/components/app-tooltip';
1516
import useSyncableProductsCalculation from '.~/hooks/useSyncableProductsCalculation';
1617
import './product-feed-status-section.scss';
1718

1819
function ProductQuantity( { quantity } ) {
19-
if ( ! Number.isInteger( quantity ) ) {
20-
return null;
21-
}
22-
2320
const text = sprintf(
2421
// translators: %d: number of products will be synced to Google Merchant Center.
2522
_n( '%d product', '%d products', quantity, 'google-listings-and-ads' ),
@@ -59,6 +56,8 @@ export default function ProductFeedStatusSection() {
5956
retrieve();
6057
}, [ retrieve ] );
6158

59+
const isReady = Number.isInteger( count );
60+
6261
return (
6362
<Section
6463
className="gla-product-feed-status-section"
@@ -77,15 +76,28 @@ export default function ProductFeedStatusSection() {
7776
<Section.Card.Body>
7877
<Flex align="flex-start" gap={ 3 }>
7978
<FlexItem>
80-
<SyncIcon />
79+
{ isReady ? (
80+
<SuccessIcon size={ 20 } />
81+
) : (
82+
<Spinner />
83+
) }
8184
</FlexItem>
8285
<FlexBlock>
8386
<Section.Card.Title>
84-
{ __(
85-
'Your product listings are being uploaded',
86-
'google-listings-and-ads'
87+
{ isReady ? (
88+
<>
89+
{ __(
90+
'Your product listings are ready to be uploaded',
91+
'google-listings-and-ads'
92+
) }
93+
<ProductQuantity quantity={ count } />
94+
</>
95+
) : (
96+
__(
97+
'Preparing your product listings',
98+
'google-listings-and-ads'
99+
)
87100
) }
88-
<ProductQuantity quantity={ count } />
89101
</Section.Card.Title>
90102
{ __(
91103
'Google will review your product listings within 3-5 days. Once approved, your products will automatically be live and searchable on Google. You’ll be notified if there are any product feed issues.',

js/src/setup-mc/setup-stepper/setup-paid-ads/product-feed-status-section.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
.gla-product-feed-status-section {
2-
.gla-sync-icon {
3-
fill: $gla-color-green;
4-
transform: rotateZ(90deg);
2+
.woocommerce-spinner {
3+
width: 20px;
4+
height: 20px;
5+
min-width: 20px;
6+
7+
&__circle {
8+
stroke: $gray-700;
9+
stroke-width: 8px;
10+
}
511
}
612

713
.wcdl-subsection-title {

0 commit comments

Comments
 (0)