From a3ec068cacf108106dd203448f8be6597831921e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leon=20Tonh=C3=A4user?=
Date: Tue, 11 Aug 2026 13:36:46 +0200
Subject: [PATCH] feat: redesign photo overview (masonry + lightbox) and fix
hoch/quer search
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The album search could not distinguish portrait from landscape: the format
filter ran client-side over a single 60-item page and relied on exifInfo that
Immich never returned (no withExif flag), so the orientation guard fell
through and every photo matched every filter. Pagination links also dropped
format/jahr on the next page.
- immich/client: send withExif: true on /search/metadata so
exifImageWidth/Height are populated for orientation filtering and masonry
aspect ratios.
- albums/filter (new): filter + paginate across the full fetched set so total,
page slice and has-more-pages stay consistent with active filters; both the
album detail and the cross-album search pages use it.
- albums/photo-gallery (new client component): masonry grid with native
EXIF aspect ratios (object-fit: cover, no more 3:2 letterboxing), hover
overlay with filename/date + merken/lizenzieren/vergrößern, and a
full-screen lightbox with keyboard nav (Esc/arrow keys).
- catalog-content: drop the old PhotoContactSheet; keep AlbumContactSheet and
thread format/jahr through PhotoPagination links.
- Album detail search form restyled to the editorial design system (sharp ink
borders) instead of the shadcn rounded card.
- Tests: filter.test.ts covers the orientation/year/pagination logic;
catalog-content.test.tsx updated to the gallery + lightbox structure;
immich client test expects withExif: true.
Skipped: global search form still uses shadcn styling (visually inconsistent
but functionally fixed); albums > 1000 photos lose tail items (noted with a
ponytail ceiling comment).
Co-Authored-By: Claude
---
src/app/globals.css | 414 ++++++++++++++++++--
src/app/redaktion/alben/[albumId]/page.tsx | 128 +++---
src/app/redaktion/alben/page.tsx | 81 ++--
src/modules/albums/catalog-content.test.tsx | 99 ++---
src/modules/albums/catalog-content.tsx | 122 ++----
src/modules/albums/catalog.ts | 3 +-
src/modules/albums/filter.test.ts | 88 +++++
src/modules/albums/filter.ts | 71 ++++
src/modules/albums/photo-gallery.tsx | 204 ++++++++++
src/modules/immich/client.test.ts | 1 +
src/modules/immich/client.ts | 5 +
11 files changed, 949 insertions(+), 267 deletions(-)
create mode 100644 src/modules/albums/filter.test.ts
create mode 100644 src/modules/albums/filter.ts
create mode 100644 src/modules/albums/photo-gallery.tsx
diff --git a/src/app/globals.css b/src/app/globals.css
index 6dfd273..68ac83d 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -569,40 +569,25 @@ a {
text-underline-offset: 0.2em;
}
-.album-contact-sheet,
-.photo-contact-sheet {
+.album-contact-sheet {
display: grid;
gap: clamp(1.25rem, 2.25vw, 2.5rem);
padding: 0;
list-style: none;
-}
-
-.album-contact-sheet {
grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}
-.photo-contact-sheet {
- grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
-}
-
.contact-sheet-link {
display: block;
color: inherit;
text-decoration: none;
}
-.album-contact-frame,
-.photo-contact-frame {
+.album-contact-frame {
margin: 0;
background: var(--contact-sheet);
-}
-
-.album-contact-frame {
border: 1px solid var(--ink);
-}
-
-.photo-contact-frame {
- border-top: 1px solid var(--ink);
+ overflow: hidden;
}
.contact-sheet-image,
@@ -615,10 +600,6 @@ a {
transition: transform 150ms ease-out;
}
-.photo-contact-frame .contact-sheet-image {
- aspect-ratio: 3 / 2;
-}
-
.missing-contact-image {
display: grid;
place-items: center;
@@ -633,11 +614,6 @@ a {
transform: scale(1.015);
}
-.album-contact-frame,
-.photo-contact-frame {
- overflow: hidden;
-}
-
.contact-strip {
display: flex;
align-items: baseline;
@@ -662,6 +638,191 @@ a {
white-space: nowrap;
}
+/* --- Photo overview: masonry grid + hover overlay + lightbox --------------
+ Replaces the old contact-sheet (forced 3:2 tiles, object-fit: contain,
+ permanent monospace caption strips). Each photo keeps its native aspect
+ ratio via an inline `aspect-ratio` set from EXIF dimensions; the grid uses
+ CSS columns for a dense masonry layout. Captions and actions appear on
+ hover/focus, and a full-screen lightbox opens on click. */
+.photo-gallery {
+ columns: 4 17rem;
+ column-gap: clamp(0.75rem, 1.5vw, 1.25rem);
+ padding: 0;
+ list-style: none;
+}
+
+@media (max-width: 64rem) {
+ .photo-gallery { columns: 3 14rem; }
+}
+@media (max-width: 48rem) {
+ .photo-gallery { columns: 2 9rem; }
+}
+
+.photo-tile {
+ break-inside: avoid;
+ margin: 0 0 clamp(0.75rem, 1.5vw, 1.25rem);
+}
+
+.photo-tile-frame {
+ position: relative;
+ margin: 0;
+ overflow: hidden;
+ background: var(--contact-sheet);
+}
+
+.photo-tile-trigger {
+ display: block;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ background: var(--contact-sheet);
+ cursor: zoom-in;
+ line-height: 0;
+}
+
+.photo-tile-image {
+ display: block;
+ width: 100%;
+ height: auto;
+ min-height: 6rem;
+ object-fit: cover;
+ background: var(--contact-sheet);
+ transition: transform 200ms ease-out;
+}
+
+.photo-tile-trigger:hover .photo-tile-image,
+.photo-tile-trigger:focus-visible .photo-tile-image {
+ transform: scale(1.02);
+}
+
+.photo-tile-overlay {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-end;
+ gap: 0.5rem;
+ padding: 0.75rem;
+ background: linear-gradient(
+ to top,
+ rgb(0 0 0 / 78%) 0%,
+ rgb(0 0 0 / 38%) 40%,
+ rgb(0 0 0 / 0%) 70%
+ );
+ opacity: 0;
+ transition: opacity 160ms ease-out;
+ pointer-events: none; /* let clicks reach the image; buttons re-enable below */
+}
+
+.photo-tile-frame:hover .photo-tile-overlay,
+.photo-tile-frame:focus-within .photo-tile-overlay {
+ opacity: 1;
+}
+
+.photo-tile-caption {
+ display: flex;
+ flex-direction: column;
+ gap: 0.125rem;
+ color: #fff;
+}
+
+.photo-tile-name {
+ font-size: 0.8rem;
+ font-weight: 600;
+ letter-spacing: 0.01em;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.photo-tile-album {
+ font-size: 0.65rem;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ opacity: 0.8;
+}
+
+.photo-tile-date {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.625rem;
+ letter-spacing: 0.03em;
+ opacity: 0.85;
+}
+
+.photo-tile-actions {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ pointer-events: auto;
+}
+
+/* Compact the full-width `.download-trigger` so it fits in the overlay row. */
+.photo-tile-actions .download-trigger,
+.lightbox-actions .download-trigger {
+ width: auto;
+ min-height: 2rem;
+ padding: 0 0.75rem;
+ border: 1px solid #fff;
+ border-top: 1px solid #fff;
+ background: rgb(255 255 255 / 12%);
+ color: #fff;
+ backdrop-filter: blur(4px);
+}
+
+.photo-tile-actions .download-trigger:hover,
+.lightbox-actions .download-trigger:hover {
+ background: #fff;
+ color: var(--ink);
+}
+
+/* Base icon-button shape for the merken toggle (no base style existed). */
+.lightbox-toggle-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 2.5rem;
+ height: 2.5rem;
+ padding: 0;
+ border: 1px solid var(--ink);
+ border-radius: 0;
+ background: var(--paper);
+ color: var(--ink);
+ cursor: pointer;
+}
+
+.lightbox-toggle-btn:hover {
+ background: var(--ink);
+ color: var(--paper);
+}
+
+.lightbox-toggle-btn.in-lightbox {
+ background: var(--ink);
+ color: var(--paper);
+}
+
+.lightbox-toggle-btn:disabled {
+ opacity: 0.6;
+ cursor: progress;
+}
+
+/* Recolor the lightbox toggle for dark overlays. */
+.photo-tile-actions .lightbox-toggle-btn,
+.lightbox-actions .lightbox-toggle-btn {
+ width: 2rem;
+ height: 2rem;
+ color: #fff;
+ background: rgb(255 255 255 / 12%);
+ border: 1px solid #fff;
+ backdrop-filter: blur(4px);
+}
+
+.photo-tile-actions .lightbox-toggle-btn:hover,
+.lightbox-actions .lightbox-toggle-btn:hover {
+ background: #fff;
+ color: var(--ink);
+}
+
.photo-search {
display: grid;
gap: 0.55rem;
@@ -736,6 +897,201 @@ a {
font-weight: 650;
}
+/* Album search form — editorial styling (sharp ink borders, paper ground),
+ aligned with the portal's browsing surface instead of the shadcn rounded
+ card used elsewhere. */
+.album-search-form {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: flex-end;
+ gap: 1rem;
+ margin: 0 0 1.5rem;
+ padding: 1rem;
+ border: 1px solid var(--ink);
+ background: var(--paper);
+}
+
+.album-search-input {
+ flex: 1 1 20rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.35rem;
+}
+
+.album-search-label {
+ font-size: 0.65rem;
+ font-weight: 700;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--metadata);
+}
+
+.album-search-input input[type="search"] {
+ width: 100%;
+ min-height: 2.75rem;
+ padding: 0.5rem 0.75rem;
+ border: 1px solid var(--ink);
+ border-radius: 0;
+ background: var(--paper);
+ color: var(--ink);
+ font: inherit;
+ font-size: 0.95rem;
+}
+
+.album-search-filters {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: flex-end;
+ gap: 1rem;
+}
+
+.album-search-select {
+ display: flex;
+ flex-direction: column;
+ gap: 0.35rem;
+ font-size: 0.65rem;
+ font-weight: 700;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--metadata);
+}
+
+.album-search-select select {
+ min-height: 2.75rem;
+ padding: 0.5rem 0.75rem;
+ border: 1px solid var(--ink);
+ border-radius: 0;
+ background: var(--paper);
+ color: var(--ink);
+ font: inherit;
+ font-size: 0.9rem;
+ text-transform: none;
+ letter-spacing: 0;
+ cursor: pointer;
+}
+
+.album-search-form button[type="submit"] {
+ min-height: 2.75rem;
+ padding: 0 1.25rem;
+ border: 1px solid var(--ink);
+ border-radius: 0;
+ background: var(--ink);
+ color: var(--paper);
+ font: inherit;
+ font-size: 0.8125rem;
+ font-weight: 700;
+ letter-spacing: 0.04em;
+ cursor: pointer;
+}
+
+.album-search-form button[type="submit"]:hover {
+ background: var(--graphite);
+}
+
+/* Full-screen photo lightbox. */
+.photo-lightbox {
+ position: fixed;
+ inset: 0;
+ z-index: 100;
+ display: grid;
+ grid-template-rows: 1fr auto;
+ align-items: center;
+ justify-items: center;
+ gap: 1rem;
+ padding: clamp(1rem, 4vw, 3rem);
+ background: rgb(0 0 0 / 92%);
+ backdrop-filter: blur(6px);
+ animation: lightbox-fade-in 160ms ease-out;
+}
+
+@keyframes lightbox-fade-in {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+
+.lightbox-figure {
+ margin: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 0.75rem;
+ max-height: 100%;
+}
+
+.lightbox-image {
+ max-height: 84vh;
+ max-width: 90vw;
+ width: auto;
+ height: auto;
+ object-fit: contain;
+ background: rgb(255 255 255 / 4%);
+}
+
+.lightbox-caption {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: 0.75rem;
+ color: #fff;
+ text-align: center;
+}
+
+.lightbox-caption .photo-tile-name {
+ font-size: 0.9rem;
+}
+
+.lightbox-actions {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+}
+
+.lightbox-close {
+ position: absolute;
+ top: clamp(0.75rem, 2vw, 1.5rem);
+ right: clamp(0.75rem, 2vw, 1.5rem);
+ width: 2.5rem;
+ height: 2.5rem;
+ border: 1px solid #fff;
+ border-radius: 0;
+ background: rgb(255 255 255 / 12%);
+ color: #fff;
+ font-size: 1.1rem;
+ cursor: pointer;
+}
+
+.lightbox-close:hover {
+ background: #fff;
+ color: var(--ink);
+}
+
+.lightbox-nav {
+ position: absolute;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 3rem;
+ height: 3rem;
+ border: 1px solid #fff;
+ border-radius: 0;
+ background: rgb(255 255 255 / 12%);
+ color: #fff;
+ font-size: 1.75rem;
+ line-height: 1;
+ cursor: pointer;
+}
+
+.lightbox-nav:hover {
+ background: #fff;
+ color: var(--ink);
+}
+
+.lightbox-prev { left: clamp(0.5rem, 2vw, 1.5rem); }
+.lightbox-next { right: clamp(0.5rem, 2vw, 1.5rem); }
+
+@media (max-width: 48rem) {
+ .lightbox-nav { width: 2.5rem; height: 2.5rem; font-size: 1.4rem; }
+}
+
.editorial-section dl {
display: grid;
grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
@@ -796,7 +1152,9 @@ a {
}
@media (prefers-reduced-motion: reduce) {
- .contact-sheet-image {
+ .contact-sheet-image,
+ .photo-tile-image,
+ .photo-tile-overlay {
transition: none;
}
}
diff --git a/src/app/redaktion/alben/[albumId]/page.tsx b/src/app/redaktion/alben/[albumId]/page.tsx
index 4bf18e4..63bb4d5 100644
--- a/src/app/redaktion/alben/[albumId]/page.tsx
+++ b/src/app/redaktion/alben/[albumId]/page.tsx
@@ -1,14 +1,22 @@
import Link from "next/link";
import { notFound } from "next/navigation";
-import { AlbumCatalogError, albumCatalog, normalizePage } from "@/modules/albums/catalog";
-import { PhotoContactSheet } from "@/modules/albums/catalog-content";
+import { AlbumCatalogError, albumCatalog, PHOTO_PAGE_SIZE } from "@/modules/albums/catalog";
+import { formatCount, PhotoPagination } from "@/modules/albums/catalog-content";
+import { filterPhotos, paginatePhotos } from "@/modules/albums/filter";
+import { PhotoGallery } from "@/modules/albums/photo-gallery";
import { loadEditorialDownloadOptions } from "@/modules/downloads/stream";
import { lightboxService } from "@/modules/lightbox/service";
import { requireEditorial } from "../../access";
import { PageHeader } from "@/components/ui/page-header";
+// ponytail: fetch the whole album in one request so hoch/quer and jahr filters
+// can be applied across the full set before paginating, instead of over a
+// single 60-item page. Ceiling: albums > 1000 photos lose tail items; raise
+// here (and the Immich size cap) if a sport album ever exceeds it.
+const ALBUM_FETCH_SIZE = 1000;
+
type AlbumPageProps = Readonly<{
params: Promise<{ albumId: string }>;
searchParams: Promise<{ page?: string | string[]; suche?: string | string[]; format?: string | string[]; jahr?: string | string[] }>;
@@ -21,7 +29,6 @@ export default async function AlbumPage({ params, searchParams }: AlbumPageProps
requireEditorial(),
]);
const query = normalizedQuery(singleValue(rawSearchParams.suche));
- const currentPage = normalizePage(singleValue(rawSearchParams.page));
const format = singleValue(rawSearchParams.format);
const jahr = singleValue(rawSearchParams.jahr);
const result = await loadAlbumPage({
@@ -52,14 +59,23 @@ export default async function AlbumPage({ params, searchParams }: AlbumPageProps
-
+ {formatCount(result.page.total, "Foto")} gefunden
+
+
+
);
@@ -70,29 +86,41 @@ function AlbumSearchForm({ albumId, query, format, jahr }: { albumId: string; qu
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);
return (
-