experimental: portfolio features (justified layout, unlisted pages, captions, per-album grid, focal point, nav links, cover hero) (#431)
## Was ist das? Sieben neue Portfolio-Features, alle als **experimental** gekennzeichnet — in YAML-Kommentaren, Admin-Panel-Labels und Commit-Scopes, damit sie einzeln nachvollziehbar und revertierbar bleiben. ## Features (je ein Commit) | Commit | Feature | | --- | --- | | `justified rows gallery layout` | Neues Grid-Layout `justified`: zeilenbasiert, gleiche Höhen, volle Breite — Flexbox ohne JS-Messung, letzte Zeile bleibt natürlich klein | | `hide subpages from navigation` | `hidden: true`: Seite aus Nav/Homepage raus, per Direktlink erreichbar — im Gegensatz zu `enabled: false` (404) | | `lightbox captions` | Immich-Asset-Description als Bildunterschrift im Info-Panel; EXIF-Route liefert bei `exifOnHover: false` jetzt nur noch die Caption statt 403 | | `per-album grid overrides` | `grid:` pro Album-Eintrag, Präzedenz global < Subpage < Album | | `per-album cover focal point` | `coverPosition:` → `object-position` auf Cover-Karten, strikt validiert | | `external links in header navigation` | `navLinks:` in settings.yaml, nur http(s), sanitisiert | | `cover splash hero style` | `heroStyle: cover`: Fullscreen-Splash mit Enter-Link ins Portfolio | Alle Optionen sind im Admin-Panel editierbar (PageBuilder / SettingsEditor). ## Tests - 356 Unit-Tests grün (13 neue: deriveGallery hidden/grid/coverPosition, sanitizeNavLinks, EXIF-Route-Captions, justified-Layout-Validierung) - `npx tsc --noEmit`: 0 Fehler - `npm run build`: sauber - Justified-Zeilenmathematik und Cover-Splash per Browser-Harness visuell/numerisch verifiziert (volle Zeilen enden exakt an der Containerkante, letzte Zeile bleibt natürlich) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
This commit is contained in:
@@ -34,7 +34,14 @@ export interface PhotoItem {
|
||||
|
||||
interface PhotoGridProps {
|
||||
assets: PhotoItem[];
|
||||
layout?: 'masonry' | 'uniform' | 'showcase' | 'filmstrip' | 'editorial-flow' | 'essay';
|
||||
layout?:
|
||||
| 'masonry'
|
||||
| 'uniform'
|
||||
| 'showcase'
|
||||
| 'filmstrip'
|
||||
| 'editorial-flow'
|
||||
| 'essay'
|
||||
| 'justified';
|
||||
gridStyle?: React.CSSProperties;
|
||||
watermark?: LightboxWatermark;
|
||||
}
|
||||
@@ -122,8 +129,21 @@ function PhotoGridInner({ assets, layout = 'masonry', gridStyle, watermark }: Ph
|
||||
return displayedAssets.map((asset, index) => {
|
||||
const isFav = proofing ? proofing.isFavorite(asset.id) : false;
|
||||
|
||||
// Justified rows: the flex sizing must sit on the outermost grid child,
|
||||
// which is the FadeIn wrapper — not the .photo-grid__item inside it.
|
||||
// Aspect ratio drives both grow factor and basis; ~3:2 fallback for
|
||||
// assets without dimensions (e.g. videos) keeps the row math sane.
|
||||
const justifiedAr = asset.aspectRatio || 1.5;
|
||||
const justifiedStyle: React.CSSProperties | undefined =
|
||||
layout === 'justified'
|
||||
? {
|
||||
flexGrow: justifiedAr,
|
||||
flexBasis: `calc(var(--grid-row-height, 300px) * ${justifiedAr})`,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<FadeIn key={asset.id} delay={index < 12 ? index * 50 : 0}>
|
||||
<FadeIn key={asset.id} delay={index < 12 ? index * 50 : 0} style={justifiedStyle}>
|
||||
<div
|
||||
className={`photo-grid__item${
|
||||
layout === 'showcase' && index === 0 ? ' photo-grid__featured' : ''
|
||||
|
||||
@@ -9,6 +9,8 @@ interface SubpageAlbum {
|
||||
albumName: string;
|
||||
assetCount: number;
|
||||
albumThumbnailAssetId: string | null;
|
||||
/** EXPERIMENTAL: focal point for the cover crop (CSS object-position) */
|
||||
coverPosition?: string;
|
||||
}
|
||||
|
||||
interface Placeholder {
|
||||
@@ -59,6 +61,7 @@ function AlbumGrid({
|
||||
fill
|
||||
sizes="(max-width: 600px) 100vw, (max-width: 1000px) 50vw, 33vw"
|
||||
loading="lazy"
|
||||
{...(album.coverPosition ? { style: { objectPosition: album.coverPosition } } : {})}
|
||||
{...(ph ? { placeholder: 'blur' as const, blurDataURL: ph.blurDataURL } : {})}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -182,6 +182,17 @@ export default async function PathPage({ params, searchParams }: PathPageProps)
|
||||
const resolveLayout = (overrides?: Partial<GridConfig>) =>
|
||||
overrides?.layout ?? config.grid.layout;
|
||||
|
||||
// EXPERIMENTAL: per-album grid override — merged over the subpage grid so
|
||||
// the precedence is global < subpage < album.
|
||||
const mergeAlbumGrid = (
|
||||
albumId: string,
|
||||
spGrid?: Partial<GridConfig>,
|
||||
): Partial<GridConfig> | undefined => {
|
||||
const albumGrid = config.albumGrids[albumId];
|
||||
if (!albumGrid) return spGrid;
|
||||
return { ...spGrid, ...albumGrid };
|
||||
};
|
||||
|
||||
if (!path || path.length === 0) {
|
||||
notFound();
|
||||
}
|
||||
@@ -225,8 +236,8 @@ export default async function PathPage({ params, searchParams }: PathPageProps)
|
||||
<AlbumDetailView
|
||||
album={album}
|
||||
images={images}
|
||||
layout={resolveLayout(spGrid)}
|
||||
gridStyle={buildGridStyle(spGrid)}
|
||||
layout={resolveLayout(mergeAlbumGrid(album.id, spGrid))}
|
||||
gridStyle={buildGridStyle(mergeAlbumGrid(album.id, spGrid))}
|
||||
backLinkHref={`/${subpageSlug}`}
|
||||
backLinkLabel={`Back to ${subpageName}`}
|
||||
watermark={config.watermark}
|
||||
@@ -341,8 +352,8 @@ export default async function PathPage({ params, searchParams }: PathPageProps)
|
||||
<AlbumDetailView
|
||||
album={album}
|
||||
images={images}
|
||||
layout={resolveLayout(result.subpage.grid)}
|
||||
gridStyle={buildGridStyle(result.subpage.grid)}
|
||||
layout={resolveLayout(mergeAlbumGrid(album.id, result.subpage.grid))}
|
||||
gridStyle={buildGridStyle(mergeAlbumGrid(album.id, result.subpage.grid))}
|
||||
subtitle={result.subpage.subtitle}
|
||||
backLinkHref="/"
|
||||
backLinkLabel="Back to Gallery"
|
||||
@@ -357,7 +368,14 @@ export default async function PathPage({ params, searchParams }: PathPageProps)
|
||||
// Override albumThumbnailAssetId with the configured hero image (if any)
|
||||
const albumsWithHero = albums.map((album) => {
|
||||
const heroId = config.albumHeroImages[album.id];
|
||||
return heroId ? { ...album, albumThumbnailAssetId: heroId } : album;
|
||||
// EXPERIMENTAL: coverPosition rides along so the card crop can honour
|
||||
// the configured focal point.
|
||||
const coverPosition = config.albumCoverPositions[album.id];
|
||||
return {
|
||||
...album,
|
||||
...(heroId ? { albumThumbnailAssetId: heroId } : {}),
|
||||
...(coverPosition ? { coverPosition } : {}),
|
||||
};
|
||||
});
|
||||
|
||||
// Batch-fetch ThumbHash for album cover placeholders
|
||||
@@ -412,8 +430,8 @@ export default async function PathPage({ params, searchParams }: PathPageProps)
|
||||
<AlbumDetailView
|
||||
album={album}
|
||||
images={images}
|
||||
layout={resolveLayout()}
|
||||
gridStyle={buildGridStyle()}
|
||||
layout={resolveLayout(mergeAlbumGrid(album.id))}
|
||||
gridStyle={buildGridStyle(mergeAlbumGrid(album.id))}
|
||||
backLinkHref="/"
|
||||
backLinkLabel="Back to Gallery"
|
||||
watermark={config.watermark}
|
||||
|
||||
Reference in New Issue
Block a user