mirror of
https://github.com/immich-app/immich.git
synced 2025-11-27 07:10:00 +09:00
perf(web): optimize date groups (#7593)
* optimize date groups * remove `.values()` * remove console.log * remove if condition * remove console.log * remove outdated comment * revert dynamic import
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { locale } from '$lib/stores/preferences.store';
|
||||
import type { AssetResponseDto } from '@immich/sdk';
|
||||
import { groupBy, sortBy } from 'lodash-es';
|
||||
import { DateTime, Interval } from 'luxon';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
@@ -44,20 +42,11 @@ export function formatGroupTitle(date: DateTime): string {
|
||||
return date.toLocaleString(groupDateFormat);
|
||||
}
|
||||
|
||||
export function splitBucketIntoDateGroups(
|
||||
assets: AssetResponseDto[],
|
||||
locale: string | undefined,
|
||||
): AssetResponseDto[][] {
|
||||
const grouped = groupBy(assets, (asset) =>
|
||||
fromLocalDateTime(asset.localDateTime).toLocaleString(groupDateFormat, { locale }),
|
||||
);
|
||||
return sortBy(grouped, (group) => assets.indexOf(group[0]));
|
||||
}
|
||||
|
||||
export type LayoutBox = {
|
||||
top: number;
|
||||
left: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
export function calculateWidth(boxes: LayoutBox[]): number {
|
||||
|
||||
Reference in New Issue
Block a user