Skip to content

Commit 1b8f69e

Browse files
Sync: Add offline status indicator to push progress UI (#2373)
* Add offline status indicator to push progress UI * Update message Co-authored-by: katinthehatsite <katerynakodonenko@gmail.com> --------- Co-authored-by: katinthehatsite <katerynakodonenko@gmail.com>
1 parent f7a4277 commit 1b8f69e

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/modules/sync/components/sync-connected-sites.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const SyncConnectedSitesSectionItem = ( {
189189
connectedSite,
190190
}: SyncConnectedSitesListProps ) => {
191191
const { __ } = useI18n();
192+
const isOffline = useOffline();
192193
const { clearPullState, getPullState, getPushState, clearPushState, cancelPull, cancelPush } =
193194
useSyncSites();
194195
const { importState } = useImportExport();
@@ -224,6 +225,20 @@ const SyncConnectedSitesSectionItem = ( {
224225
pushState?.uploadProgress
225226
);
226227

228+
const getPushProgressTooltip = () => {
229+
if ( isOffline ) {
230+
return __(
231+
"You are currently offline. Sync will continue running remotely. We will send you an email once it's completed."
232+
);
233+
}
234+
if ( pushBackupIsUploading( pushState?.status.key ) ) {
235+
return __( 'Push is in progress. We will send you an email when it is completed.' );
236+
}
237+
return __(
238+
"The push is in progress and will continue running remotely. We will send you an email once it's completed."
239+
);
240+
};
241+
227242
return (
228243
<div className="grid grid-cols-[max-content_1fr_max-content]">
229244
<div
@@ -312,19 +327,14 @@ const SyncConnectedSitesSectionItem = ( {
312327
) }
313328
{ pushState?.status && isPushing && (
314329
<div className="flex items-center gap-2 max-w-full">
315-
<Tooltip
316-
text={
317-
pushBackupIsUploading( pushState?.status.key )
318-
? __( 'Push is in progress. We will send you an email when it is completed.' )
319-
: __(
320-
"The push is in progress and will continue running remotely. We will send you an email once it's completed."
321-
)
322-
}
323-
placement="top-start"
324-
>
330+
<Tooltip text={ getPushProgressTooltip() } placement="top-start">
325331
<div className="flex flex-col gap-2 min-w-44 flex-shrink">
326332
<div className="a8c-body-small flex items-center gap-0.5">
327-
<Icon icon={ info } size={ 16 } />
333+
{ isOffline ? (
334+
<Icon icon={ offlineIcon } size={ 12 } className="fill-a8c-gray-70" />
335+
) : (
336+
<Icon icon={ info } size={ 14 } />
337+
) }
328338
{ getPushUploadMessage( pushState.status.message, uploadPercentage ) }
329339
</div>
330340
<ProgressBar value={ pushState.status.progress } maxValue={ 100 } />

0 commit comments

Comments
 (0)