Jason Rasmussen a16d233a0c
chore(web): sort imports (#27922)
* feat: sort imports

* fix: something?
2026-04-21 14:51:38 -04:00

61 lines
1.6 KiB
TypeScript

import { getTimeBucket } from '@immich/sdk';
import { authManager } from '$lib/managers/auth-manager.svelte';
import { toISOYearMonthUTC } from '$lib/utils/timeline-util';
import { TimelineManager } from '../timeline-manager.svelte';
import type { TimelineMonth } from '../timeline-month.svelte';
import type { TimelineManagerOptions } from '../types';
export async function loadFromTimeBuckets(
timelineManager: TimelineManager,
timelineMonth: TimelineMonth,
options: TimelineManagerOptions,
signal: AbortSignal,
): Promise<void> {
if (timelineMonth.getFirstAsset()) {
return;
}
const timeBucket = toISOYearMonthUTC(timelineMonth.yearMonth);
const bucketResponse = await getTimeBucket(
{
...authManager.params,
...options,
timeBucket,
},
{ signal },
);
if (!bucketResponse || signal.aborted) {
return;
}
if (options.timelineAlbumId) {
const albumAssets = await getTimeBucket(
{
...authManager.params,
albumId: options.timelineAlbumId,
timeBucket,
},
{ signal },
);
if (!albumAssets || signal.aborted) {
return;
}
for (const id of albumAssets.id) {
timelineManager.albumAssets.add(id);
}
}
const unprocessedAssets = timelineMonth.addAssets(bucketResponse, true);
if (unprocessedAssets.length > 0) {
console.error(
`Warning: getTimeBucket API returning assets not in requested month: ${timelineMonth.yearMonth.month}, ${JSON.stringify(
unprocessedAssets.map((unprocessed) => ({
id: unprocessed.id,
localDateTime: unprocessed.localDateTime,
})),
)}`,
);
}
}