From f3c15c7df807d303c784c08d9820b6cc7a05b6d7 Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:45:20 +0200 Subject: [PATCH] feat(web): full screen view for duplicates (#10346) * feat(web): full screen view for duplicates * styling: make button visibility better --------- Co-authored-by: Alex --- .../duplicates/duplicate-asset.svelte | 94 ++++++++++++ .../duplicates-compare-control.svelte | 140 +++++++----------- .../utilities-page/utilities-menu.svelte | 5 +- web/src/lib/i18n/en.json | 9 ++ .../[[assetId=id]]/+page.svelte | 24 ++- .../[[photos=photos]]/[[assetId=id]]/+page.ts | 0 6 files changed, 170 insertions(+), 102 deletions(-) create mode 100644 web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte rename web/src/routes/(user)/utilities/{[duplicates] => duplicates}/[[photos=photos]]/[[assetId=id]]/+page.svelte (84%) rename web/src/routes/(user)/utilities/{[duplicates] => duplicates}/[[photos=photos]]/[[assetId=id]]/+page.ts (100%) diff --git a/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte new file mode 100644 index 0000000000000..0f30eb6166088 --- /dev/null +++ b/web/src/lib/components/utilities-page/duplicates/duplicate-asset.svelte @@ -0,0 +1,94 @@ + + +
+
+ + + +
+ + + + + + + + + + + + + + +
{asset.originalFileName}
{getAssetResolution(asset)} - {getFileSize(asset)}
+ {#await getAllAlbums({ assetId: asset.id })} + {$t('scanning_for_album')} + {:then albums} + {#if albums.length === 0} + {$t('not_in_any_album')} + {:else} + {$t('in_albums', { values: { count: albums.length } })} + {/if} + {/await} +
+
diff --git a/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte b/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte index 436693922e896..b9405c617f5d5 100644 --- a/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte +++ b/web/src/lib/components/utilities-page/duplicates/duplicates-compare-control.svelte @@ -1,27 +1,29 @@ -
+
- {#each duplicate.assets as asset, index (index)} - {@const isSelected = selectedAssetIds.has(asset.id)} - {@const isFromExternalLibrary = !!asset.libraryId} - {@const assetData = JSON.stringify(asset, null, 2)} - -
- - - - - - - - - - - - - - - -
{asset.originalFileName}
{getAssetResolution(asset)} - {getFileSize(asset)}
- {#await getAllAlbums({ assetId: asset.id })} - Scanning for album... - {:then albums} - {#if albums.length === 0} - Not in any album - {:else} - In {albums.length} album{s(albums.length)} - {/if} - {/await} -
-
+ {#each assets as asset (asset.id)} + setAsset(asset)} + /> {/each}
-
+
{:else} - {/if}
+ +{#if $showAssetViewer} + {#await import('$lib/components/asset-viewer/asset-viewer.svelte') then { default: AssetViewer }} + + 1} + on:next={() => { + const index = getAssetIndex($viewingAsset.id) + 1; + setAsset(assets[index % assets.length]); + }} + on:previous={() => { + const index = getAssetIndex($viewingAsset.id) - 1 + assets.length; + setAsset(assets[index % assets.length]); + }} + on:close={() => assetViewingStore.showAssetViewer(false)} + /> + + {/await} +{/if} diff --git a/web/src/lib/components/utilities-page/utilities-menu.svelte b/web/src/lib/components/utilities-page/utilities-menu.svelte index 4589d7aadfce7..7deddc6bee20a 100644 --- a/web/src/lib/components/utilities-page/utilities-menu.svelte +++ b/web/src/lib/components/utilities-page/utilities-menu.svelte @@ -8,7 +8,10 @@

{$t('organize_your_library').toUpperCase()}

- + diff --git a/web/src/lib/i18n/en.json b/web/src/lib/i18n/en.json index 45950869c4fd2..ff6e97bd2cee5 100644 --- a/web/src/lib/i18n/en.json +++ b/web/src/lib/i18n/en.json @@ -318,6 +318,7 @@ "archived": "Archived", "asset_offline": "Asset offline", "assets": "Assets", + "assets_moved_to_trash": "Moved {count, plural, one {# asset} other {# assets}} to trash", "authorized_devices": "Authorized Devices", "back": "Back", "backward": "Backward", @@ -396,6 +397,7 @@ "delete": "Delete", "delete_album": "Delete album", "delete_api_key_prompt": "Are you sure you want to delete this API key?", + "delete_duplicates_confirmation": "Are you sure you want to permanently delete these duplicates?", "delete_key": "Delete key", "delete_library": "Delete library", "delete_link": "Delete link", @@ -420,6 +422,7 @@ "download_settings_description": "Manage settings related to asset download", "downloading": "Downloading", "duplicates": "Duplicates", + "duplicates_description": "Resolve each group by indicating which, if any, are duplicates", "duration": "Duration", "durations": { "days": "{days, plural, one {day} other {{days, number} days}}", @@ -561,6 +564,7 @@ "immich_web_interface": "Immich Web Interface", "import_from_json": "Import from JSON", "import_path": "Import path", + "in_albums": "In {count, plural, one {# album} other {# albums}}", "in_archive": "In archive", "include_archived": "Include archived", "include_shared_albums": "Include shared albums", @@ -577,6 +581,7 @@ "invite_to_album": "Invite to album", "jobs": "Jobs", "keep": "Keep", + "keep_all": "Keep All", "keyboard_shortcuts": "Keyboard shortcuts", "language": "Language", "language_setting_description": "Select your preferred language", @@ -756,6 +761,7 @@ "scan_all_library_files": "Re-scan All Library Files", "scan_new_library_files": "Scan New Library Files", "scan_settings": "Scan Settings", + "scanning_for_album": "Scanning for album...", "search": "Search", "search_albums": "Search albums", "search_by_context": "Search by context", @@ -854,12 +860,14 @@ "timezone": "Timezone", "to_archive": "Archive", "to_favorite": "Favorite", + "to_trash": "Trash", "toggle_settings": "Toggle settings", "toggle_theme": "Toggle theme", "toggle_visibility": "Toggle visibility", "total_usage": "Total usage", "trash": "Trash", "trash_all": "Trash All", + "trash_count": "Trash {count}", "trash_no_results_message": "Trashed photos and videos will show up here.", "trashed_items_will_be_permanently_deleted_after": "Trashed items will be permanently deleted after {days, plural, one {# day} other {# days}}.", "type": "Type", @@ -898,6 +906,7 @@ "video_hover_setting_description": "Play video thumbnail when mouse is hovering over item. Even when disabled, playback can be started by hovering over the play icon.", "videos": "Videos", "videos_count": "{count, plural, one {# Video} other {# Videos}}", + "view": "View", "view_all": "View All", "view_all_users": "View all users", "view_links": "View links", diff --git a/web/src/routes/(user)/utilities/[duplicates]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte similarity index 84% rename from web/src/routes/(user)/utilities/[duplicates]/[[photos=photos]]/[[assetId=id]]/+page.svelte rename to web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte index b0b51d3b378e8..7c048e8ed0d55 100644 --- a/web/src/routes/(user)/utilities/[duplicates]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/utilities/duplicates/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -1,18 +1,16 @@