Make lightbox full-bleed by default to match Immich

This commit is contained in:
Alan Grainger
2026-06-14 09:50:57 +12:00
parent 28b61d01e8
commit 6b33e50cde
3 changed files with 28 additions and 14 deletions
+5 -1
View File
@@ -45,7 +45,11 @@
color: var(--pswp-icon-color); color: var(--pswp-icon-color);
} }
/* The zoom, counter, and close buttons are suppressed via PhotoSwipe options
(counter/zoom/close: false in client/lightbox.ts) so they can be re-enabled
through ipp.lightbox.options, rather than being hidden here in CSS. We use a
top-left back arrow (registered as `back-button` in client/lightbox-ui.ts)
in place of the close button, matching Immich's native asset-viewer. */
.pswp__button--download-button { .pswp__button--download-button {
color: #fff; color: #fff;
+16 -6
View File
@@ -82,14 +82,24 @@ function buildDataSource () {
export function initLightbox () { export function initLightbox () {
const { options = {} } = state.lightboxConfig const { options = {} } = state.lightboxConfig
// Extract padding to use as defaults, and paddingFn to avoid overwriting our function with an object from JSON // Pull `padding` out as an override. Drop any `paddingFn` coming from config
const { padding, paddingFn: _ignoredPaddingFn, ...restOptions } = options as any // without overwriting ours: PhotoSwipe expects a function there, so an object
// from JSON would crash it.
const configPadding = options.padding as Partial<Record<'top' | 'bottom' | 'left' | 'right', number>> | undefined
const restOptions = { ...options }
delete restOptions.padding
delete restOptions.paddingFn
// Full-bleed by default, the same as Immich. Reserve a bottom strip only when captions
// are enabled, so the caption has somewhere to sit without overlapping the image.
// Operators can override these via ipp.lightbox.options.padding
const showCaption = !!state.metadataConfig.descriptionInCaption
const basePadding = { const basePadding = {
top: padding?.top ?? 56, top: 0,
bottom: padding?.bottom ?? 56, bottom: showCaption ? 56 : 0,
left: padding?.left ?? 16, left: 0,
right: padding?.right ?? 16 right: 0,
...configPadding
} }
state.lightbox = new PhotoSwipeLightbox({ state.lightbox = new PhotoSwipeLightbox({
+7 -7
View File
@@ -102,13 +102,13 @@ Example: show the gallery title and group photos by month.
The gallery's lightbox is powered by [PhotoSwipe](https://photoswipe.com/). Configured under `ipp.lightbox`. The gallery's lightbox is powered by [PhotoSwipe](https://photoswipe.com/). Configured under `ipp.lightbox`.
| Option | Type | Description | | Option | Type | Description |
|----------------|----------|------------------------------------------------------------------------------------------------------------------------------------------| |------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `showArrows` | `bool` | Show the prev/next arrows on desktop. They appear when the user hovers the lightbox. Default `true`. | | `showArrows` | `bool` | Show the prev/next arrows on desktop. They appear when the user hovers the lightbox. Default `true`. |
| `showDownload` | `bool` | Show a download button in the lightbox toolbar. Only takes effect when downloads are also allowed by `allowDownloadAll`. Default `true`. | | `showDownload` | `bool` | Show a download button in the lightbox toolbar. Only takes effect when downloads are also allowed by `allowDownloadAll`. Default `true`. |
| `mobileArrows` | `bool` | Show prev/next arrows on mobile (under 640px viewport). Off by default since swipe is the natural mobile navigation. | | `mobileArrows` | `bool` | Show prev/next arrows on mobile (under 640px viewport). Off by default since swipe is the natural mobile navigation. |
| `autoPlayVideos` | `bool` | Automatically play videos when their slide opens or becomes active. If the browser blocks unmuted autoplay (e.g. when deep-linking straight to a video), playback falls back to muted. Default `false`. | | `autoPlayVideos` | `bool` | Automatically play videos when their slide opens or becomes active. If the browser blocks unmuted autoplay (e.g. when deep-linking straight to a video), playback falls back to muted. Default `false`. |
| `options` | `object` | Custom [PhotoSwipe options](https://photoswipe.com/options/) to override defaults (e.g. `{"wheelToZoom": true}`). | | `options` | `object` | Custom [PhotoSwipe options](https://photoswipe.com/options/) to override defaults (e.g. `{"wheelToZoom": true}`). |
Example: hide the download button inside the lightbox even though zip downloads are otherwise allowed. Example: hide the download button inside the lightbox even though zip downloads are otherwise allowed.