diff --git a/src/main/events/profile/update-profile.ts b/src/main/events/profile/update-profile.ts index 4135aae5..eb80bc47 100644 --- a/src/main/events/profile/update-profile.ts +++ b/src/main/events/profile/update-profile.ts @@ -33,9 +33,6 @@ const getNewProfileImageUrl = async (localImageUrl: string) => { headers: { "Content-Type": mimeType, }, - onUploadProgress: (progressEvent) => { - console.log(progressEvent); - }, }); return profileImageUrl; diff --git a/src/renderer/src/context/cloud-sync/cloud-sync.context.tsx b/src/renderer/src/context/cloud-sync/cloud-sync.context.tsx index 38bbdb40..2f0addaf 100644 --- a/src/renderer/src/context/cloud-sync/cloud-sync.context.tsx +++ b/src/renderer/src/context/cloud-sync/cloud-sync.context.tsx @@ -25,7 +25,7 @@ export interface CloudSyncContext { setShowCloudSyncModal: React.Dispatch>; downloadGameArtifact: (gameArtifactId: string) => Promise; uploadSaveGame: () => Promise; - deleteGameArtifact: (gameArtifactId: string) => Promise<{ ok: boolean }>; + deleteGameArtifact: (gameArtifactId: string) => Promise; restoringBackup: boolean; uploadingBackup: boolean; } @@ -39,7 +39,7 @@ export const cloudSyncContext = createContext({ downloadGameArtifact: async () => {}, uploadSaveGame: async () => {}, artifacts: [], - deleteGameArtifact: async () => ({ ok: false }), + deleteGameArtifact: async () => {}, restoringBackup: false, uploadingBackup: false, }); @@ -135,20 +135,26 @@ export function CloudSyncContextProvider({ async (gameArtifactId: string) => { return window.electron.deleteGameArtifact(gameArtifactId).then(() => { getGameBackupPreview(); - return { ok: true }; }); }, [getGameBackupPreview] ); useEffect(() => { - getGameBackupPreview(); - window.electron.checkGameCloudSyncSupport(objectId, shop).then((result) => { setSupportsCloudSync(result); }); }, [objectId, shop, getGameBackupPreview]); + useEffect(() => { + setBackupPreview(null); + setArtifacts([]); + setSupportsCloudSync(null); + setShowCloudSyncModal(false); + setRestoringBackup(false); + setUploadingBackup(false); + }, [objectId, shop]); + useEffect(() => { if (showCloudSyncModal) { getGameBackupPreview(); diff --git a/src/renderer/src/hooks/use-user-details.ts b/src/renderer/src/hooks/use-user-details.ts index ed2c3b14..7e08144d 100644 --- a/src/renderer/src/hooks/use-user-details.ts +++ b/src/renderer/src/hooks/use-user-details.ts @@ -46,32 +46,9 @@ export function useUserDetails() { const updateUserDetails = useCallback( async (userDetails: UserDetails) => { dispatch(setUserDetails(userDetails)); - - if (userDetails.profileImageUrl) { - // TODO: Decide if we want to use this - // const profileBackground = await profileBackgroundFromProfileImage( - // userDetails.profileImageUrl - // ).catch((err) => { - // logger.error("profileBackgroundFromProfileImage", err); - // return `#151515B3`; - // }); - // dispatch(setProfileBackground(profileBackground)); - - window.localStorage.setItem( - "userDetails", - JSON.stringify({ ...userDetails, profileBackground }) - ); - } else { - const profileBackground = `#151515B3`; - dispatch(setProfileBackground(profileBackground)); - - window.localStorage.setItem( - "userDetails", - JSON.stringify({ ...userDetails, profileBackground }) - ); - } + window.localStorage.setItem("userDetails", JSON.stringify(userDetails)); }, - [dispatch, profileBackground] + [dispatch] ); const fetchUserDetails = useCallback(async () => { diff --git a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx index fd38eb76..7461c4b2 100644 --- a/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx +++ b/src/renderer/src/pages/game-details/cloud-sync-modal/cloud-sync-modal.tsx @@ -87,8 +87,12 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) { ); } - return "no_backups"; - }, [uploadingBackup, lastBackup, restoringBackup]); + if (!backupPreview) { + return "no_backup_preview"; + } + + return "no_artifacts"; + }, [uploadingBackup, lastBackup, backupPreview, restoringBackup]); const disableActions = uploadingBackup || restoringBackup || deletingArtifact; @@ -116,7 +120,7 @@ export function CloudSyncModal({ visible, onClose }: CloudSyncModalProps) {