mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-01-17 14:46:20 +00:00
refactor(server,web): time buckets for main timeline, archived, and favorites (1) (#3537)
* refactor: time buckets * feat(web): use new time bucket api * feat(web): use asset grid in archive/favorites * chore: open api * chore: clean up uuid validation * refactor(web): move memory lane to photos page * Update web/src/routes/(user)/archive/+page.svelte Co-authored-by: Sergey Kondrikov <sergey.kondrikov@gmail.com> * fix: hide archived photos on main timeline * fix: select exif info --------- Co-authored-by: Sergey Kondrikov <sergey.kondrikov@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { api, AssetResponseDto, GetAssetCountByTimeBucketDto } from '@api';
|
||||
import { api, AssetApiGetTimeBucketsRequest, AssetResponseDto } from '@api';
|
||||
import { writable } from 'svelte/store';
|
||||
import { handleError } from '../utils/handle-error';
|
||||
|
||||
@@ -9,7 +9,7 @@ export enum BucketPosition {
|
||||
Unknown = 'unknown',
|
||||
}
|
||||
|
||||
export type AssetStoreOptions = GetAssetCountByTimeBucketDto;
|
||||
export type AssetStoreOptions = AssetApiGetTimeBucketsRequest;
|
||||
|
||||
export interface Viewport {
|
||||
width: number;
|
||||
@@ -51,11 +51,9 @@ export class AssetStore {
|
||||
subscribe = this.store$.subscribe;
|
||||
|
||||
async init(viewport: Viewport) {
|
||||
const { data } = await api.assetApi.getAssetCountByTimeBucket({
|
||||
getAssetCountByTimeBucketDto: { ...this.options, withoutThumbs: true },
|
||||
});
|
||||
const { data: buckets } = await api.assetApi.getTimeBuckets(this.options);
|
||||
|
||||
this.buckets = data.buckets.map((bucket) => {
|
||||
this.buckets = buckets.map((bucket) => {
|
||||
const unwrappedWidth = (3 / 2) * bucket.count * THUMBNAIL_HEIGHT * (7 / 10);
|
||||
const rows = Math.ceil(unwrappedWidth / viewport.width);
|
||||
const height = rows * THUMBNAIL_HEIGHT;
|
||||
@@ -101,14 +99,8 @@ export class AssetStore {
|
||||
|
||||
bucket.cancelToken = new AbortController();
|
||||
|
||||
const { data: assets } = await api.assetApi.getAssetByTimeBucket(
|
||||
{
|
||||
getAssetByTimeBucketDto: {
|
||||
timeBucket: [bucketDate],
|
||||
...this.options,
|
||||
withoutThumbs: true,
|
||||
},
|
||||
},
|
||||
const { data: assets } = await api.assetApi.getByTimeBucket(
|
||||
{ ...this.options, timeBucket: bucketDate },
|
||||
{ signal: bucket.cancelToken.signal },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user