feat(web): shuffle slideshow order (#4277)
* feat(web): shuffle slideshow order * Fix play/stop issues * Enter/exit fullscreen mode * Prevent navigation to the next asset after exiting slideshow mode * Fix entering the slideshow mode from an album page * Simplify markup of the AssetViewer Group viewer area and navigation (prev/next/slideshow bar) controls together * Select a random asset from a random bucket * Preserve assets order in random mode * Exit fullscreen mode only if it is active * Extract SlideshowHistory class * Use traditional functions instead of arrow functions * Refactor SlideshowHistory class * Extract SlideshowBar component * Fix comments * Hide Say something in slideshow mode --------- Co-authored-by: brighteyed <sergey.kondrikov@gmail.com>
This commit is contained in:
@@ -304,6 +304,19 @@ export class AssetStore {
|
||||
return this.assetToBucket[assetId]?.bucketIndex ?? null;
|
||||
}
|
||||
|
||||
async getRandomAsset(): Promise<AssetResponseDto | null> {
|
||||
const bucket = this.buckets[Math.floor(Math.random() * this.buckets.length)] || null;
|
||||
if (!bucket) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (bucket.assets.length === 0) {
|
||||
await this.loadBucket(bucket.bucketDate, BucketPosition.Unknown);
|
||||
}
|
||||
|
||||
return bucket.assets[Math.floor(Math.random() * bucket.assets.length)] || null;
|
||||
}
|
||||
|
||||
updateAsset(_asset: AssetResponseDto) {
|
||||
const asset = this.assets.find((asset) => asset.id === _asset.id);
|
||||
if (!asset) {
|
||||
|
||||
Reference in New Issue
Block a user