Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
54011fc
Add pause and play icons for sync upload controls
gavande1 Jan 12, 2026
0fd7a49
Add pause/resume IPC handlers for TUS uploads
gavande1 Jan 12, 2026
7963083
Add uploadingManuallyPaused state and update cancel logic
gavande1 Jan 12, 2026
56baa4c
Add pause/resume upload hooks and expose in context
gavande1 Jan 12, 2026
d24028e
Add pause/resume UI controls for sync uploads
gavande1 Jan 12, 2026
beb7875
Update tests to include pause/resume upload mocks
gavande1 Jan 12, 2026
6cd11b2
Fix TUS upload cancellation to prevent reply never sent error
gavande1 Jan 14, 2026
6e779d7
Fix tooltip position
gavande1 Jan 14, 2026
78b80c8
Add error handling for aborted export in sync push hook
gavande1 Jan 16, 2026
5a0d878
Abort existing TUS upload before starting a new one
gavande1 Jan 16, 2026
11d2101
Update PauseIcon component
gavande1 Jan 16, 2026
9892f91
Refactor PauseIcon component to use a smaller size
gavande1 Jan 20, 2026
2ec6e22
Update upload pause logic to conditionally
gavande1 Jan 20, 2026
f3c1926
Improve sync upload pause/resume logic to check manual pause state
gavande1 Jan 20, 2026
a7ad509
Improve sync UI transitions and fix layout shifts
epeicher Jan 27, 2026
593a92a
Merge branch 'trunk' of github.com:Automattic/studio into stu-1143-pa…
epeicher Jan 27, 2026
cb53da0
Move the pause icon down a bit for better alignment
epeicher Jan 27, 2026
1ced096
Fix vertical shift when displaying Push complete
epeicher Jan 27, 2026
45f4e4b
Fix right padding on the sync buttons
epeicher Jan 27, 2026
27bfbe8
Merge branch 'trunk' of github.com:Automattic/studio into stu-1143-pa…
epeicher Jan 27, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/icons/pause.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const PauseIcon = () => (
Comment thread
gavande1 marked this conversation as resolved.
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="6" y="6" width="2" height="12" rx="1" fill="currentColor" />
<rect x="12" y="6" width="2" height="12" rx="1" fill="currentColor" />
</svg>
);
5 changes: 5 additions & 0 deletions src/components/icons/play.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const PlayIcon = () => (
Comment thread
gavande1 marked this conversation as resolved.
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.5 3.5L13.5 9.5L5.5 15.5V3.5Z" fill="currentColor" />
</svg>
);
24 changes: 17 additions & 7 deletions src/hooks/sync-sites/sync-sites-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@ export function SyncSitesProvider( { children }: { children: React.ReactNode } )
} );

const [ pushStates, setPushStates ] = useState< PushStates >( {} );
const { pushSite, isAnySitePushing, isSiteIdPushing, clearPushState, getPushState, cancelPush } =
useSyncPush( {
pushStates,
setPushStates,
onPushSuccess: ( remoteSiteId, localSiteId ) =>
updateSiteTimestamp( { siteId: remoteSiteId, localSiteId, type: 'push' } ),
} );
const {
pushSite,
isAnySitePushing,
isSiteIdPushing,
clearPushState,
getPushState,
cancelPush,
pauseUpload,
resumeUpload,
} = useSyncPush( {
pushStates,
setPushStates,
onPushSuccess: ( remoteSiteId, localSiteId ) =>
updateSiteTimestamp( { siteId: remoteSiteId, localSiteId, type: 'push' } ),
} );

useListenDeepLinkConnection();

Expand Down Expand Up @@ -145,6 +153,8 @@ export function SyncSitesProvider( { children }: { children: React.ReactNode } )
isSiteIdPushing,
clearPushState,
cancelPush,
pauseUpload,
resumeUpload,
getLastSyncTimeText,
} }
>
Expand Down
34 changes: 33 additions & 1 deletion src/hooks/sync-sites/use-sync-push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type UseSyncPushProps = {
};

type CancelPush = ( selectedSiteId: string, remoteSiteId: number ) => void;
type PauseUpload = ( selectedSiteId: string, remoteSiteId: number ) => Promise< boolean >;
type ResumeUpload = ( selectedSiteId: string, remoteSiteId: number ) => Promise< boolean >;

export type UseSyncPush = {
pushStates: PushStates;
Expand All @@ -60,6 +62,8 @@ export type UseSyncPush = {
isSiteIdPushing: IsSiteIdPushing;
clearPushState: ClearState;
cancelPush: CancelPush;
pauseUpload: PauseUpload;
resumeUpload: ResumeUpload;
};

/**
Expand Down Expand Up @@ -349,6 +353,13 @@ export function useSyncPush( {
throw response;
}
} catch ( error ) {
if ( error instanceof Error && error.message === 'Export aborted' ) {
updatePushState( selectedSite.id, remoteSiteId, {
status: pushStatesProgressInfo.cancelled,
} );
return;
}

Sentry.captureException( error );
updatePushState( selectedSite.id, remoteSiteId, {
status: pushStatesProgressInfo.failed,
Expand Down Expand Up @@ -401,14 +412,25 @@ export function useSyncPush( {
] );

useIpcListener(
'sync-upload-paused',
'sync-upload-network-paused',
( _event, payload: { selectedSiteId: string; remoteSiteId: number; error: string } ) => {
updatePushState( payload.selectedSiteId, payload.remoteSiteId, {
status: pushStatesProgressInfo.uploadingPaused,
} );
}
);

useIpcListener(
'sync-upload-manually-paused',
( _event, payload: { selectedSiteId: string; remoteSiteId: number } ) => {
const currentState = getPushState( payload.selectedSiteId, payload.remoteSiteId );
updatePushState( payload.selectedSiteId, payload.remoteSiteId, {
status: pushStatesProgressInfo.uploadingManuallyPaused,
uploadProgress: currentState?.uploadProgress,
} );
}
);

useIpcListener(
'sync-upload-resumed',
( _event, payload: { selectedSiteId: string; remoteSiteId: number } ) => {
Expand Down Expand Up @@ -477,6 +499,14 @@ export function useSyncPush( {
[ __, pushStatesProgressInfo.cancelled, updatePushState ]
);

const pauseUpload = useCallback< PauseUpload >( async ( selectedSiteId, remoteSiteId ) => {
return getIpcApi().pauseSyncUpload( selectedSiteId, remoteSiteId );
}, [] );

const resumeUpload = useCallback< ResumeUpload >( async ( selectedSiteId, remoteSiteId ) => {
return getIpcApi().resumeSyncUpload( selectedSiteId, remoteSiteId );
}, [] );

return {
pushStates,
getPushState,
Expand All @@ -485,5 +515,7 @@ export function useSyncPush( {
isSiteIdPushing,
clearPushState,
cancelPush,
pauseUpload,
resumeUpload,
};
}
2 changes: 2 additions & 0 deletions src/hooks/tests/use-add-site.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ describe( 'useAddSite', () => {
getPushState: jest.fn(),
getLastSyncTimeText: jest.fn(),
cancelPush: jest.fn(),
pauseUpload: jest.fn(),
resumeUpload: jest.fn(),
} as SyncSitesContextType );

mockSetSelectedTab.mockReset();
Expand Down
13 changes: 12 additions & 1 deletion src/hooks/use-sync-states-progress-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export type PushStateProgressInfo = {
| 'finished'
| 'failed'
| 'cancelled'
| 'uploadingPaused';
| 'uploadingPaused'
| 'uploadingManuallyPaused';
progress: number;
message: string;
};
Expand Down Expand Up @@ -87,6 +88,10 @@ function isKeyUploadingPaused( key: PushStateProgressInfo[ 'key' ] | undefined )
return key === 'uploadingPaused';
}

function isKeyUploadingManuallyPaused( key: PushStateProgressInfo[ 'key' ] | undefined ): boolean {
return key === 'uploadingManuallyPaused';
}

function isKeyUploading( key: PushStateProgressInfo[ 'key' ] | undefined ): boolean {
return key === 'uploading';
}
Expand Down Expand Up @@ -186,6 +191,11 @@ export function useSyncStatesProgressInfo() {
progress: 45,
message: __( 'Uploading paused' ),
},
uploadingManuallyPaused: {
key: 'uploadingManuallyPaused',
progress: 45,
message: __( 'Uploading paused' ),
},
creatingRemoteBackup: {
key: 'creatingRemoteBackup',
progress: 50,
Expand Down Expand Up @@ -354,5 +364,6 @@ export function useSyncStatesProgressInfo() {
getPushUploadMessage,
mapUploadProgressToOverallProgress,
isKeyUploadingPaused,
isKeyUploadingManuallyPaused,
};
}
2 changes: 2 additions & 0 deletions src/ipc-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ export {
downloadSyncBackup,
exportSiteForPush,
getConnectedWpcomSites,
pauseSyncUpload,
pushArchive,
removeExportedSiteTmpFile,
removeSyncBackup,
resumeSyncUpload,
updateConnectedWpcomSites,
updateSingleConnectedWpcomSite,
} from 'src/modules/sync/lib/ipc-handlers';
Expand Down
3 changes: 2 additions & 1 deletion src/ipc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ export interface IpcEvents {
'on-site-create-progress': [ { siteId: string; message: string } ];
'site-context-menu-action': [ { action: string; siteId: string } ];
'site-event': [ SiteEvent ];
'sync-upload-paused': [ { error: string; selectedSiteId: string; remoteSiteId: number } ];
'sync-upload-network-paused': [ { error: string; selectedSiteId: string; remoteSiteId: number } ];
'sync-upload-resumed': [ { selectedSiteId: string; remoteSiteId: number } ];
'sync-upload-progress': [ { selectedSiteId: string; remoteSiteId: number; progress: number } ];
'sync-upload-manually-paused': [ { selectedSiteId: string; remoteSiteId: number } ];
'snapshot-error': [ { operationId: crypto.UUID; data: SnapshotEventData } ];
'snapshot-fatal-error': [ { operationId: crypto.UUID; data: { message: string } } ];
'snapshot-output': [ { operationId: crypto.UUID; data: SnapshotEventData } ];
Expand Down
12 changes: 10 additions & 2 deletions src/lib/active-sync-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export function canCancelPull( key: PullStateProgressInfo[ 'key' ] | undefined )
* Check if a push operation can be cancelled based on its current state.
*/
export function canCancelPush( key: PushStateProgressInfo[ 'key' ] | undefined ): boolean {
const cancellableStateKeys: PushStateProgressInfo[ 'key' ][] = [ 'creatingBackup' ];
const cancellableStateKeys: PushStateProgressInfo[ 'key' ][] = [
'creatingBackup',
'uploading',
'uploadingManuallyPaused',
];
if ( ! key ) {
return false;
}
Expand All @@ -44,7 +48,11 @@ export function canCancelPush( key: PushStateProgressInfo[ 'key' ] | undefined )
* Check if a push operation has finished uploading the backup file.
*/
export function pushBackupIsUploading( key: PushStateProgressInfo[ 'key' ] | undefined ): boolean {
const uploadingStateKeys: PushStateProgressInfo[ 'key' ][] = [ 'creatingBackup', 'uploading' ];
const uploadingStateKeys: PushStateProgressInfo[ 'key' ][] = [
'creatingBackup',
'uploading',
'uploadingManuallyPaused',
];
if ( ! key ) {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/modules/add-site/tests/add-site.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ beforeEach( () => {
getPushState: jest.fn(),
getLastSyncTimeText: jest.fn(),
cancelPush: jest.fn(),
pauseUpload: jest.fn(),
resumeUpload: jest.fn(),
} as SyncSitesContextType );
mockSetSelectedTab.mockReset();

Expand Down
Loading