Gate shares behind magic-link sessions, add comments and new-photo email digests
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import PhotoSwipeLightbox from '/share/static/photoswipe/photoswipe-lightbox.esm.js' // eslint-disable-line import/no-absolute-path
|
||||
|
||||
import type { PhotoSwipeOptions } from 'photoswipe'
|
||||
import { state, SIDEBAR_WIDTH, MOBILE_BREAKPOINT } from './state.js'
|
||||
import { state, SIDEBAR_WIDTH, SIDEBAR_SHEET_FRACTION, MOBILE_BREAKPOINT } from './state.js'
|
||||
import type { GalleryItem } from '../shared/types.js'
|
||||
import {
|
||||
registerBackButton,
|
||||
@@ -211,14 +211,19 @@ export function initLightbox () {
|
||||
// precedence over `padding`, and spreading it last neutralises any `padding`
|
||||
// or (mistyped) `paddingFn` an operator put in config. Their static `padding`
|
||||
// is still honoured above via basePadding. It lets the sidebar shrink the
|
||||
// slide viewport when docked; on a narrow viewport the sidebar overlays
|
||||
// instead, so we leave padding alone there.
|
||||
paddingFn: () => ({
|
||||
...basePadding,
|
||||
right: state.sidebarOpen && window.innerWidth >= MOBILE_BREAKPOINT
|
||||
? SIDEBAR_WIDTH + basePadding.right
|
||||
: basePadding.right
|
||||
}),
|
||||
// slide viewport: from the right when docked, and from the bottom when it
|
||||
// is a bottom sheet on a narrow viewport, so the photo stays in view above
|
||||
// the comments.
|
||||
paddingFn: () => {
|
||||
const narrow = window.innerWidth < MOBILE_BREAKPOINT
|
||||
return {
|
||||
...basePadding,
|
||||
right: state.sidebarOpen && !narrow ? SIDEBAR_WIDTH + basePadding.right : basePadding.right,
|
||||
bottom: state.sidebarOpen && narrow
|
||||
? Math.round(window.innerHeight * SIDEBAR_SHEET_FRACTION) + basePadding.bottom
|
||||
: basePadding.bottom
|
||||
}
|
||||
},
|
||||
dataSource: buildDataSource(),
|
||||
// @ts-expect-error - runtime URL resolved by Express static
|
||||
pswpModule: () => import('/share/static/photoswipe/photoswipe.esm.js') // eslint-disable-line import/no-absolute-path
|
||||
|
||||
Reference in New Issue
Block a user