mirror of
https://github.com/immich-app/immich.git
synced 2026-03-26 20:00:44 +03:00
feat: loop slideshows (#25462)
* Add Repeat to the slideshow in the web UI. * Fix typo in SlideshowSettingsModal description prop Fixed spelling --------- Co-authored-by: generalzero <generalzero@generalzero.org>
This commit is contained in:
committed by
GitHub
parent
d0d269677e
commit
497003ec57
@@ -2118,6 +2118,8 @@
|
|||||||
"skip_to_folders": "Skip to folders",
|
"skip_to_folders": "Skip to folders",
|
||||||
"skip_to_tags": "Skip to tags",
|
"skip_to_tags": "Skip to tags",
|
||||||
"slideshow": "Slideshow",
|
"slideshow": "Slideshow",
|
||||||
|
"slideshow_repeat": "Repeat slideshow",
|
||||||
|
"slideshow_repeat_description": "Loop back to beginning when slideshow ends",
|
||||||
"slideshow_settings": "Slideshow settings",
|
"slideshow_settings": "Slideshow settings",
|
||||||
"sort_albums_by": "Sort albums by...",
|
"sort_albums_by": "Sort albums by...",
|
||||||
"sort_created": "Date created",
|
"sort_created": "Date created",
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
slideshowNavigation,
|
slideshowNavigation,
|
||||||
slideshowState,
|
slideshowState,
|
||||||
slideshowTransition,
|
slideshowTransition,
|
||||||
|
slideshowRepeat,
|
||||||
} = slideshowStore;
|
} = slideshowStore;
|
||||||
const stackThumbnailSize = 60;
|
const stackThumbnailSize = 60;
|
||||||
const stackSelectedThumbnailSize = 65;
|
const stackSelectedThumbnailSize = 65;
|
||||||
@@ -109,6 +110,7 @@
|
|||||||
let stack: StackResponseDto | null = $state(null);
|
let stack: StackResponseDto | null = $state(null);
|
||||||
|
|
||||||
let playOriginalVideo = $state($alwaysLoadOriginalVideo);
|
let playOriginalVideo = $state($alwaysLoadOriginalVideo);
|
||||||
|
let slideshowStartAssetId = $state<string>();
|
||||||
|
|
||||||
const setPlayOriginalVideo = (value: boolean) => {
|
const setPlayOriginalVideo = (value: boolean) => {
|
||||||
playOriginalVideo = value;
|
playOriginalVideo = value;
|
||||||
@@ -238,6 +240,10 @@
|
|||||||
if ($slideshowState === SlideshowState.PlaySlideshow) {
|
if ($slideshowState === SlideshowState.PlaySlideshow) {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
$restartSlideshowProgress = true;
|
$restartSlideshowProgress = true;
|
||||||
|
} else if ($slideshowRepeat && slideshowStartAssetId) {
|
||||||
|
// Loop back to starting asset
|
||||||
|
await setAssetId(slideshowStartAssetId);
|
||||||
|
$restartSlideshowProgress = true;
|
||||||
} else {
|
} else {
|
||||||
await handleStopSlideshow();
|
await handleStopSlideshow();
|
||||||
}
|
}
|
||||||
@@ -262,6 +268,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handlePlaySlideshow = async () => {
|
const handlePlaySlideshow = async () => {
|
||||||
|
slideshowStartAssetId = asset.id;
|
||||||
try {
|
try {
|
||||||
await assetViewerHtmlElement?.requestFullscreen?.();
|
await assetViewerHtmlElement?.requestFullscreen?.();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
slideshowLook,
|
slideshowLook,
|
||||||
slideshowTransition,
|
slideshowTransition,
|
||||||
slideshowAutoplay,
|
slideshowAutoplay,
|
||||||
|
slideshowRepeat,
|
||||||
slideshowState,
|
slideshowState,
|
||||||
} = slideshowStore;
|
} = slideshowStore;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
let tempSlideshowLook = $state($slideshowLook);
|
let tempSlideshowLook = $state($slideshowLook);
|
||||||
let tempSlideshowTransition = $state($slideshowTransition);
|
let tempSlideshowTransition = $state($slideshowTransition);
|
||||||
let tempSlideshowAutoplay = $state($slideshowAutoplay);
|
let tempSlideshowAutoplay = $state($slideshowAutoplay);
|
||||||
|
let tempSlideshowRepeat = $state($slideshowRepeat);
|
||||||
|
|
||||||
const navigationOptions: Record<SlideshowNavigation, RenderedOption> = {
|
const navigationOptions: Record<SlideshowNavigation, RenderedOption> = {
|
||||||
[SlideshowNavigation.Shuffle]: { icon: mdiShuffle, title: $t('shuffle') },
|
[SlideshowNavigation.Shuffle]: { icon: mdiShuffle, title: $t('shuffle') },
|
||||||
@@ -67,6 +69,7 @@
|
|||||||
$slideshowLook = tempSlideshowLook;
|
$slideshowLook = tempSlideshowLook;
|
||||||
$slideshowTransition = tempSlideshowTransition;
|
$slideshowTransition = tempSlideshowTransition;
|
||||||
$slideshowAutoplay = tempSlideshowAutoplay;
|
$slideshowAutoplay = tempSlideshowAutoplay;
|
||||||
|
$slideshowRepeat = tempSlideshowRepeat;
|
||||||
$slideshowState = SlideshowState.PlaySlideshow;
|
$slideshowState = SlideshowState.PlaySlideshow;
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
@@ -104,6 +107,10 @@
|
|||||||
<Switch bind:checked={tempSlideshowTransition} />
|
<Switch bind:checked={tempSlideshowTransition} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
|
<Field label={$t('slideshow_repeat')} description={$t('slideshow_repeat_description')}>
|
||||||
|
<Switch bind:checked={tempSlideshowRepeat} />
|
||||||
|
</Field>
|
||||||
|
|
||||||
<Field label={$t('duration')}>
|
<Field label={$t('duration')}>
|
||||||
<NumberInput min={1} bind:value={tempSlideshowDelay} />
|
<NumberInput min={1} bind:value={tempSlideshowDelay} />
|
||||||
<HelperText>{$t('admin.slideshow_duration_description')}</HelperText>
|
<HelperText>{$t('admin.slideshow_duration_description')}</HelperText>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ function createSlideshowStore() {
|
|||||||
const slideshowDelay = persisted<number>('slideshow-delay', 5, {});
|
const slideshowDelay = persisted<number>('slideshow-delay', 5, {});
|
||||||
const slideshowTransition = persisted<boolean>('slideshow-transition', true);
|
const slideshowTransition = persisted<boolean>('slideshow-transition', true);
|
||||||
const slideshowAutoplay = persisted<boolean>('slideshow-autoplay', true, {});
|
const slideshowAutoplay = persisted<boolean>('slideshow-autoplay', true, {});
|
||||||
|
const slideshowRepeat = persisted<boolean>('slideshow-repeat', false);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restartProgress: {
|
restartProgress: {
|
||||||
@@ -71,6 +72,7 @@ function createSlideshowStore() {
|
|||||||
showProgressBar,
|
showProgressBar,
|
||||||
slideshowTransition,
|
slideshowTransition,
|
||||||
slideshowAutoplay,
|
slideshowAutoplay,
|
||||||
|
slideshowRepeat,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user