mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 09:15:34 +03:00
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:
45
web/src/lib/stores/slideshow.store.ts
Normal file
45
web/src/lib/stores/slideshow.store.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { persisted } from 'svelte-local-storage-store';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export enum SlideshowState {
|
||||
PlaySlideshow = 'play-slideshow',
|
||||
StopSlideshow = 'stop-slideshow',
|
||||
None = 'none',
|
||||
}
|
||||
|
||||
function createSlideshowStore() {
|
||||
const restartState = writable<boolean>(false);
|
||||
const stopState = writable<boolean>(false);
|
||||
|
||||
const slideshowShuffle = persisted<boolean>('slideshow-shuffle', true);
|
||||
const slideshowState = writable<SlideshowState>(SlideshowState.None);
|
||||
|
||||
return {
|
||||
restartProgress: {
|
||||
subscribe: restartState.subscribe,
|
||||
set: (value: boolean) => {
|
||||
// Trigger an action whenever the restartProgress is set to true. Automatically
|
||||
// reset the restart state after that
|
||||
if (value) {
|
||||
restartState.set(true);
|
||||
restartState.set(false);
|
||||
}
|
||||
},
|
||||
},
|
||||
stopProgress: {
|
||||
subscribe: stopState.subscribe,
|
||||
set: (value: boolean) => {
|
||||
// Trigger an action whenever the stopProgress is set to true. Automatically
|
||||
// reset the stop state after that
|
||||
if (value) {
|
||||
stopState.set(true);
|
||||
stopState.set(false);
|
||||
}
|
||||
},
|
||||
},
|
||||
slideshowShuffle,
|
||||
slideshowState,
|
||||
};
|
||||
}
|
||||
|
||||
export const slideshowStore = createSlideshowStore();
|
||||
Reference in New Issue
Block a user