4021c66cec
Show a badge on the gallery thumbnail and a lightbox toggle that plays the photo's clip over the still, matching Immich's own viewer. The clip is a hidden Immich asset, but the existing share key already authorises it - checkSharedLinkAccess whitelists each shared asset's livePhotoVideoId - so no new upstream access is involved. The video route accepts a clip id only when a shared still points at it. Both enumeration paths already carry the field (AssetResponseDto for individual shares, TimeBucketAssetResponseDto for album buckets), so album shares cost no extra upstream requests. Gated by ipp.motionPhotos (default true). The clip is preload="none" and is only fetched when a visitor presses the toggle.
191 lines
5.0 KiB
CSS
191 lines
5.0 KiB
CSS
/*
|
|
PhotoSwipe overrides to match Immich's AssetViewer aesthetic.
|
|
Layered on top of photoswipe/photoswipe.css.
|
|
*/
|
|
|
|
.pswp {
|
|
--pswp-bg: #000;
|
|
--pswp-placeholder-bg: #111;
|
|
--pswp-icon-color: #fff;
|
|
--pswp-icon-color-secondary: transparent;
|
|
--pswp-icon-stroke-width: 0;
|
|
--pswp-error-text-color: #fff;
|
|
--pswp-preloader-color: rgba(255, 255, 255, 0.4);
|
|
--pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9);
|
|
--pswp-transition-duration: 250ms;
|
|
}
|
|
|
|
/* Top toolbar: subtle dark backdrop, no shadows */
|
|
.pswp__top-bar {
|
|
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
|
|
height: 56px;
|
|
}
|
|
|
|
/* Standard icon buttons: cleaner sizing, hover state */
|
|
.pswp__top-bar .pswp__button {
|
|
width: 44px;
|
|
height: 44px;
|
|
margin: 6px;
|
|
border-radius: 50%;
|
|
transition: background-color 0.15s;
|
|
}
|
|
|
|
.pswp__top-bar .pswp__button:hover,
|
|
.pswp__top-bar .pswp__button:focus-visible {
|
|
background-color: rgba(255, 255, 255, 0.12);
|
|
outline: none;
|
|
}
|
|
|
|
.pswp__top-bar .pswp__button .pswp__icn {
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
width: 22px;
|
|
height: 22px;
|
|
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 {
|
|
color: #fff;
|
|
}
|
|
|
|
/* Side arrows: hover-revealed on desktop, hidden by default on mobile */
|
|
.pswp__button--arrow {
|
|
width: 56px;
|
|
height: 100px;
|
|
margin-top: -50px;
|
|
opacity: 0;
|
|
transition: opacity 0.2s, background-color 0.15s;
|
|
border-radius: 8px;
|
|
background-color: transparent;
|
|
}
|
|
|
|
.pswp:hover .pswp__button--arrow {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.pswp__button--arrow:hover,
|
|
.pswp__button--arrow:focus-visible {
|
|
opacity: 1;
|
|
background-color: rgba(255, 255, 255, 0.12);
|
|
outline: none;
|
|
}
|
|
|
|
/* Disable arrows at far ends of gallery */
|
|
.pswp__button--arrow:disabled {
|
|
opacity: 0 !important;
|
|
cursor: default;
|
|
}
|
|
|
|
/* Mobile: PhotoSwipe already auto-fades top bar; here we just hide arrows
|
|
when configured to do so (default, matches Immich mobile). */
|
|
html.pswp-no-arrows .pswp__button--arrow {
|
|
display: none !important;
|
|
}
|
|
|
|
/* When the info sidebar is open on desktop, both the top toolbar (which is
|
|
absolutely positioned at right: 0) and the next-arrow button (right: 0)
|
|
would sit underneath the 360px sidebar. Shift them inward so they stay
|
|
visible inside the now-narrower slide viewport. Mobile is unaffected
|
|
because the sidebar there is a bottom sheet, not a right-side dock. */
|
|
@media (min-width: 641px) {
|
|
html.ipp-sidebar-open .pswp__top-bar {
|
|
right: 360px;
|
|
width: auto;
|
|
}
|
|
html.ipp-sidebar-open .pswp__button--arrow--next {
|
|
right: 360px;
|
|
}
|
|
html.ipp-sidebar-open .pswp__video-wrap {
|
|
padding-right: 360px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
html.pswp-no-mobile-arrows .pswp__button--arrow {
|
|
display: none !important;
|
|
}
|
|
/* Mobile top bar is shorter and translucent */
|
|
.pswp__top-bar {
|
|
height: 48px;
|
|
}
|
|
}
|
|
|
|
/* Video slide content */
|
|
.pswp__video-wrap {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
pointer-events: none; /* let PhotoSwipe handle gestures except on the video */
|
|
}
|
|
|
|
.pswp__video-wrap video {
|
|
/* Fill the slide area immediately (the poster sizes the element before the
|
|
stream loads) so the container doesn't snap to a new size when the video's
|
|
real dimensions arrive. */
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: contain;
|
|
outline: none;
|
|
pointer-events: auto;
|
|
background: #000;
|
|
}
|
|
|
|
/* Motion photo (Live Photo) clip. It lives inside the slide's zoom wrap, which
|
|
carries PhotoSwipe's pan/zoom transform, so it stays pinned to the still
|
|
underneath through zoom, pan and resize with no geometry tracking in JS. */
|
|
.pswp__motion-video {
|
|
position: absolute;
|
|
inset: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: contain;
|
|
pointer-events: none; /* PhotoSwipe keeps handling drag / zoom / swipe */
|
|
}
|
|
|
|
.pswp__zoom-wrap.pswp--motion-playing .pswp__img {
|
|
opacity: 0;
|
|
}
|
|
|
|
/* PhotoSwipe's `.pswp__button { display: block }` outranks the browser's
|
|
`[hidden]` rule, so a toolbar button that hides itself needs this. */
|
|
.pswp__button[hidden] {
|
|
display: none;
|
|
}
|
|
|
|
/* Smooth backdrop fade in/out to match Immich's open/close feel */
|
|
.pswp__bg {
|
|
transition: opacity var(--pswp-transition-duration);
|
|
}
|
|
|
|
/* Image caption (from EXIF description) - centered in the 56px bottom margin
|
|
carved out by the lightbox `padding.bottom` setting. */
|
|
.pswp__caption {
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
height: 56px;
|
|
padding: 0 24px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #fff;
|
|
font-size: 14px;
|
|
line-height: 1.4;
|
|
text-align: center;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.pswp__caption[hidden] {
|
|
display: none;
|
|
}
|