mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(web): timeline bucket for albums (4) (#3604)
* feat: server changes for album timeline * feat(web): album timeline view * chore: open api * chore: remove archive action * fix: favorite for non-owners
This commit is contained in:
parent
36dc7bd924
commit
5cd13227ad
47 changed files with 1014 additions and 757 deletions
|
|
@ -43,14 +43,21 @@ export class AssetStore {
|
|||
timelineHeight = 0;
|
||||
buckets: AssetBucket[] = [];
|
||||
assets: AssetResponseDto[] = [];
|
||||
albumAssets: Set<string> = new Set();
|
||||
|
||||
constructor(private options: AssetStoreOptions) {
|
||||
constructor(private options: AssetStoreOptions, private albumId?: string) {
|
||||
this.store$.set(this);
|
||||
}
|
||||
|
||||
subscribe = this.store$.subscribe;
|
||||
|
||||
async init(viewport: Viewport) {
|
||||
this.timelineHeight = 0;
|
||||
this.buckets = [];
|
||||
this.assets = [];
|
||||
this.assetToBucket = {};
|
||||
this.albumAssets = new Set();
|
||||
|
||||
const { data: buckets } = await api.assetApi.getTimeBuckets(this.options);
|
||||
|
||||
this.buckets = buckets.map((bucket) => {
|
||||
|
|
@ -104,6 +111,22 @@ export class AssetStore {
|
|||
{ signal: bucket.cancelToken.signal },
|
||||
);
|
||||
|
||||
if (this.albumId) {
|
||||
const { data: albumAssets } = await api.assetApi.getByTimeBucket(
|
||||
{
|
||||
albumId: this.albumId,
|
||||
timeBucket: bucketDate,
|
||||
size: this.options.size,
|
||||
key: this.options.key,
|
||||
},
|
||||
{ signal: bucket.cancelToken.signal },
|
||||
);
|
||||
|
||||
for (const asset of albumAssets) {
|
||||
this.albumAssets.add(asset.id);
|
||||
}
|
||||
}
|
||||
|
||||
bucket.assets = assets;
|
||||
this.emit(true);
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue