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:
Jason Rasmussen 2023-08-11 12:00:51 -04:00 committed by GitHub
parent 36dc7bd924
commit 5cd13227ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 1014 additions and 757 deletions

View file

@ -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) {