1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-10 13:56:47 +01:00
immich/web/src/lib/models/asset-grid-state.ts
Sergey Kondrikov 5764bf16f3
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 <alex.tran1502@gmail.com>
2023-06-08 10:22:45 -05:00

53 lines
1 KiB
TypeScript

import type { AssetResponseDto } from '@api';
export enum BucketPosition {
Above = 'above',
Below = 'below',
Visible = 'visible',
Unknown = 'unknown'
}
export class AssetBucket {
/**
* The DOM height of the bucket in pixel
* This value is first estimated by the number of asset and later is corrected as the user scroll
*/
bucketHeight!: number;
bucketDate!: string;
assets!: AssetResponseDto[];
cancelToken!: AbortController;
position!: BucketPosition;
}
export class AssetGridState {
/**
* The total height of the timeline in pixel
* This value is first estimated by the number of asset and later is corrected as the user scroll
*/
timelineHeight = 0;
/**
* The fixed viewport height in pixel
*/
viewportHeight = 0;
/**
* The fixed viewport width in pixel
*/
viewportWidth = 0;
/**
* List of bucket information
*/
buckets: AssetBucket[] = [];
/**
* Total assets that have been loaded
*/
assets: AssetResponseDto[] = [];
/**
* User that owns assets
*/
userId: string | undefined;
}