pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix local upload for migration

Pas 0a6c162b aab87f1c

+45 -4
+4 -2
src/assets/locales/en.json
··· 397 397 "status": { 398 398 "processing": "Processing data...", 399 399 "error": "Failed to upload your data. ๐Ÿ˜ฟ", 400 - "success": "Your data has been uploaded successfully! ๐ŸŽ‰" 400 + "success": "Your data has been uploaded successfully! ๐ŸŽ‰", 401 + "successLocal": "Your data has been saved locally! ๐ŸŽ‰" 401 402 }, 402 403 "file": { 403 404 "description": "Select the file you want to upload", ··· 415 416 "import": "Import data", 416 417 "processing": "Processing...", 417 418 "success": "Import complete", 418 - "home": "Continue to home" 419 + "home": "Continue to home", 420 + "saveLocal": "Save locally" 419 421 } 420 422 }, 421 423 "back": "Go back"
+41 -2
src/pages/migration/MigrationUpload.tsx
··· 171 171 status, 172 172 ]); 173 173 174 + const handleLocalSave = useCallback(() => { 175 + if (!uploadedData) return; 176 + setStatus("processing"); 177 + try { 178 + if (uploadedData.bookmarks) { 179 + localStorage.setItem( 180 + "__MW::bookmarks", 181 + JSON.stringify({ state: { bookmarks: uploadedData.bookmarks } }), 182 + ); 183 + replaceBookmarks(uploadedData.bookmarks); 184 + } 185 + if (uploadedData.progress) { 186 + localStorage.setItem( 187 + "__MW::progress", 188 + JSON.stringify({ state: { items: uploadedData.progress } }), 189 + ); 190 + replaceProgress(uploadedData.progress); 191 + } 192 + setStatus("success"); 193 + } catch (e) { 194 + setStatus("error"); 195 + } 196 + }, [uploadedData, replaceBookmarks, replaceProgress]); 197 + 174 198 return ( 175 199 <MinimalPageLayout> 176 200 <PageTitle k="migration.upload.title" subpage /> ··· 284 308 {status === "success" ? ( 285 309 <div className="flex items-center gap-2 text-green-400"> 286 310 <Icon icon={Icons.CHECKMARK} className="pr-2" /> 287 - {t("migration.upload.status.success")} 311 + {user.account 312 + ? t("migration.upload.status.success") 313 + : t("migration.upload.status.successLocal")} 288 314 </div> 289 - ) : ( 315 + ) : user.account ? ( 290 316 <Button 291 317 onClick={handleImport} 292 318 className="w-full max-w-xs" ··· 298 324 {status === "processing" 299 325 ? t("migration.upload.button.processing") 300 326 : t("migration.upload.button.import")} 327 + </Button> 328 + ) : ( 329 + <Button 330 + onClick={handleLocalSave} 331 + className="w-full max-w-xs" 332 + theme="purple" 333 + padding="md:px-12 p-2.5" 334 + disabled={status === "processing"} 335 + > 336 + <Icon icon={Icons.CLOUD_ARROW_UP} className="pr-2" /> 337 + {status === "processing" 338 + ? t("migration.upload.button.processing") 339 + : t("migration.upload.button.saveLocal")} 301 340 </Button> 302 341 )} 303 342 </div>