From 5764bf16f3970a796e63ba6c0e141620deb70ebf Mon Sep 17 00:00:00 2001 From: Sergey Kondrikov Date: Thu, 8 Jun 2023 18:22:45 +0300 Subject: [PATCH] feat(web, server): Implement justified layout for AssetGrid (#2666) * Implement justified layout for timeline * Add withoutThumbs field to GetTimelineLayotDto * Back to rough estimation of initial buckets height * Remove getTimelineLayout endpoint * Estimate rough viewport height better * Fix shift/jump issues while scrolling up --------- Co-authored-by: Alex Tran --- .../immich/api-v1/asset/asset-repository.ts | 1 + web/package-lock.json | 11 +++ web/package.json | 1 + .../asset-viewer/intersection-observer.svelte | 13 +++- .../photos-page/asset-date-group.svelte | 75 +++++++++++++++++-- .../components/photos-page/asset-grid.svelte | 18 +++-- web/src/lib/models/asset-grid-state.ts | 8 ++ web/src/lib/stores/asset-interaction.store.ts | 4 +- web/src/lib/stores/assets.store.ts | 57 ++++++++++---- web/src/lib/utils/asset-utils.ts | 15 ++++ web/src/lib/utils/viewport-utils.ts | 14 ---- 11 files changed, 172 insertions(+), 45 deletions(-) delete mode 100644 web/src/lib/utils/viewport-utils.ts diff --git a/server/src/immich/api-v1/asset/asset-repository.ts b/server/src/immich/api-v1/asset/asset-repository.ts index 6f2bf49527..def006c79e 100644 --- a/server/src/immich/api-v1/asset/asset-repository.ts +++ b/server/src/immich/api-v1/asset/asset-repository.ts @@ -104,6 +104,7 @@ export class AssetRepository implements IAssetRepository { // Get asset entity from a list of time buckets let builder = this.assetRepository .createQueryBuilder('asset') + .leftJoinAndSelect('asset.exifInfo', 'exifInfo') .where('asset.ownerId = :userId', { userId: userId }) .andWhere(`date_trunc('month', "fileCreatedAt") IN (:...buckets)`, { buckets: [...dto.timeBucket], diff --git a/web/package-lock.json b/web/package-lock.json index 9c73fc4bdb..585e049a43 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -12,6 +12,7 @@ "axios": "^0.27.2", "copy-image-clipboard": "^2.1.2", "handlebars": "^4.7.7", + "justified-layout": "^4.1.0", "leaflet": "^1.9.3", "leaflet.markercluster": "^1.5.3", "lodash-es": "^4.17.21", @@ -9076,6 +9077,11 @@ "node": ">=6" } }, + "node_modules/justified-layout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/justified-layout/-/justified-layout-4.1.0.tgz", + "integrity": "sha512-M5FimNMXgiOYerVRGsXZ2YK9YNCaTtwtYp7Hb2308U1Q9TXXHx5G0p08mcVR5O53qf8bWY4NJcPBxE6zuayXSg==" + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -18186,6 +18192,11 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "justified-layout": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/justified-layout/-/justified-layout-4.1.0.tgz", + "integrity": "sha512-M5FimNMXgiOYerVRGsXZ2YK9YNCaTtwtYp7Hb2308U1Q9TXXHx5G0p08mcVR5O53qf8bWY4NJcPBxE6zuayXSg==" + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", diff --git a/web/package.json b/web/package.json index 09df801a19..2b8bd617d0 100644 --- a/web/package.json +++ b/web/package.json @@ -62,6 +62,7 @@ "axios": "^0.27.2", "copy-image-clipboard": "^2.1.2", "handlebars": "^4.7.7", + "justified-layout": "^4.1.0", "leaflet": "^1.9.3", "leaflet.markercluster": "^1.5.3", "lodash-es": "^4.17.21", diff --git a/web/src/lib/components/asset-viewer/intersection-observer.svelte b/web/src/lib/components/asset-viewer/intersection-observer.svelte index f08a244db1..b373c2d346 100644 --- a/web/src/lib/components/asset-viewer/intersection-observer.svelte +++ b/web/src/lib/components/asset-viewer/intersection-observer.svelte @@ -1,4 +1,5 @@