Revert "perf(web): optimize date groups" (#7638)

Revert "perf(web): optimize date groups (#7593)"

This reverts commit 762c4684f8.
This commit is contained in:
Michel Heusschen 2024-03-05 16:43:24 +01:00 committed by GitHub
parent 967019d9e0
commit facd0bc3a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 103 additions and 95 deletions

View file

@ -2,9 +2,15 @@
import Icon from '$lib/components/elements/icon.svelte';
import type { AssetInteractionStore } from '$lib/stores/asset-interaction.store';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import type { AssetBucket, AssetStore, Viewport } from '$lib/stores/assets.store';
import type { AssetStore, Viewport } from '$lib/stores/assets.store';
import { locale } from '$lib/stores/preferences.store';
import { getAssetRatio } from '$lib/utils/asset-utils';
import { calculateWidth, formatGroupTitle, fromLocalDateTime } from '$lib/utils/timeline-util';
import {
calculateWidth,
formatGroupTitle,
fromLocalDateTime,
splitBucketIntoDateGroups,
} from '$lib/utils/timeline-util';
import type { AssetResponseDto } from '@immich/sdk';
import { mdiCheckCircle, mdiCircleOutline } from '@mdi/js';
import justifiedLayout from 'justified-layout';
@ -12,7 +18,9 @@
import { fly } from 'svelte/transition';
import Thumbnail from '../assets/thumbnail/thumbnail.svelte';
export let bucket: AssetBucket;
export let assets: AssetResponseDto[];
export let bucketDate: string;
export let bucketHeight: number;
export let isSelectionMode = false;
export let viewport: Viewport;
export let singleSelect = false;
@ -34,7 +42,7 @@
let actualBucketHeight: number;
let hoveredDateGroup = '';
$: assetsGroupByDate = [...bucket.dateGroups.values()];
$: assetsGroupByDate = splitBucketIntoDateGroups(assets, $locale);
$: geometry = (() => {
const geometry = [];
@ -58,8 +66,8 @@
})();
$: {
if (actualBucketHeight && actualBucketHeight !== 0 && actualBucketHeight != bucket.height) {
const heightDelta = assetStore.updateBucket(bucket.date, actualBucketHeight);
if (actualBucketHeight && actualBucketHeight !== 0 && actualBucketHeight != bucketHeight) {
const heightDelta = assetStore.updateBucket(bucketDate, actualBucketHeight);
if (heightDelta !== 0) {
scrollTimeline(heightDelta);
}