feat: redesign album overview to match photo grid + surface download/merkzettel errors
Album overview:
- AlbumContactSheet now uses cover tiles in the photo-gallery aesthetic:
object-fit: cover, 4/3 tiles, persistent bottom gradient with album name
+ photo count, hover zoom. Drops the old 3:2 contain tiles + monospace
caption strip.
Diagnostics (download + merkzettel both failed silently for the user):
- UsageDialog now reads the server's { code } from /api/download-intents and
maps each stable error code (FORBIDDEN, NOT_FOUND, UPSTREAM_UNAVAILABLE,
ACCOUNTING_UNAVAILABLE, ...) to a specific German message instead of the
generic "try again". The fallback includes the raw code so unmapped
failures stay actionable when reported back.
- LightboxToggleButton logs the caught server-action error to the console
(and notes the dev terminal) instead of reverting the optimistic toggle
with no signal. Root cause still needs the live error; this makes it
visible.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
a3ec068cac
commit
a7df6bd60a
4 files changed
+103
-57
No files matched your search
+40
-39
@@ -569,73 +569,74 @@ a {
|
|||||||
text-underline-offset: 0.2em;
|
text-underline-offset: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-contact-sheet {
|
/* --- Album overview: grid of cover tiles in the photo-gallery aesthetic ---
|
||||||
|
Cover images use object-fit: cover with a consistent 4/3 tile (album
|
||||||
|
summaries don't carry EXIF, so no native per-cover aspect ratio), a
|
||||||
|
persistent bottom gradient with album name + photo count, and a hover
|
||||||
|
zoom. Clicking opens the album. Mirrors the photo grid's hover language. */
|
||||||
|
.album-gallery {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: clamp(1.25rem, 2.25vw, 2.5rem);
|
gap: clamp(0.75rem, 1.5vw, 1.25rem);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-sheet-link {
|
.album-tile {
|
||||||
display: block;
|
display: block;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.album-contact-frame {
|
.album-tile-frame {
|
||||||
|
position: relative;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background: var(--contact-sheet);
|
|
||||||
border: 1px solid var(--ink);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background: var(--contact-sheet);
|
||||||
|
aspect-ratio: 4 / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-sheet-image,
|
.album-tile-image {
|
||||||
.missing-contact-image {
|
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
aspect-ratio: 3 / 2;
|
height: 100%;
|
||||||
object-fit: contain;
|
object-fit: cover;
|
||||||
background: var(--contact-sheet);
|
background: var(--contact-sheet);
|
||||||
transition: transform 150ms ease-out;
|
transition: transform 200ms ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.missing-contact-image {
|
.album-tile-missing {
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
color: var(--metadata);
|
color: var(--metadata);
|
||||||
font-size: 0.75rem;
|
font-size: 0.7rem;
|
||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-sheet-link:hover .contact-sheet-image,
|
.album-tile:hover .album-tile-image,
|
||||||
.contact-sheet-link:focus-visible .contact-sheet-image {
|
.album-tile:focus-visible .album-tile-image {
|
||||||
transform: scale(1.015);
|
transform: scale(1.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-strip {
|
/* Persistent overlay (unlike the photo grid's hover-only overlay) — album
|
||||||
|
names need to be readable at a glance so editors can pick one. */
|
||||||
|
.album-tile-overlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: baseline;
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
gap: 0.75rem;
|
padding: 0.75rem;
|
||||||
min-height: 2.35rem;
|
background: linear-gradient(
|
||||||
margin: 0;
|
to top,
|
||||||
padding: 0.5rem 0.625rem;
|
rgb(0 0 0 / 85%) 0%,
|
||||||
border-top: 1px solid var(--ink);
|
rgb(0 0 0 / 30%) 55%,
|
||||||
background: var(--contact-sheet);
|
rgb(0 0 0 / 0%) 85%
|
||||||
color: var(--graphite);
|
);
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
pointer-events: none;
|
||||||
font-size: 0.625rem;
|
|
||||||
letter-spacing: 0.035em;
|
|
||||||
line-height: 1.25;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-strip-name {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- Photo overview: masonry grid + hover overlay + lightbox --------------
|
/* --- Photo overview: masonry grid + hover overlay + lightbox --------------
|
||||||
@@ -1152,7 +1153,7 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.contact-sheet-image,
|
.album-tile-image,
|
||||||
.photo-tile-image,
|
.photo-tile-image,
|
||||||
.photo-tile-overlay {
|
.photo-tile-overlay {
|
||||||
transition: none;
|
transition: none;
|
||||||
|
|||||||
@@ -23,8 +23,12 @@ export function LightboxToggleButton({ assetId, initialInLightbox }: LightboxTog
|
|||||||
try {
|
try {
|
||||||
const result = await toggleLightboxItem(assetId);
|
const result = await toggleLightboxItem(assetId);
|
||||||
setInLightbox(result.isNowInLightbox);
|
setInLightbox(result.isNowInLightbox);
|
||||||
} catch {
|
} catch (error) {
|
||||||
// Revert on error
|
// Revert the optimistic toggle and surface the real cause. Server
|
||||||
|
// action errors also print to the dev server terminal — check there
|
||||||
|
// for the stack trace. Without this the button just flips back
|
||||||
|
// silently and the user can't tell why the merkzettel "doesn't work".
|
||||||
|
console.error("[merkzettel] toggleLightboxItem failed:", error);
|
||||||
setInLightbox(inLightbox);
|
setInLightbox(inLightbox);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -87,7 +87,11 @@ export function UsageDialog({
|
|||||||
headers: { "content-type": "application/json" },
|
headers: { "content-type": "application/json" },
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
});
|
});
|
||||||
if (!response.ok) throw new Error("intent failed");
|
if (!response.ok) {
|
||||||
|
const code = await readErrorCode(response);
|
||||||
|
setError(downloadErrorMessage(code, response.status));
|
||||||
|
return;
|
||||||
|
}
|
||||||
const intent = (await response.json()) as IntentResponse;
|
const intent = (await response.json()) as IntentResponse;
|
||||||
if (!isLocalDownloadUrl(intent.fileUrl, intent.downloadId)) {
|
if (!isLocalDownloadUrl(intent.fileUrl, intent.downloadId)) {
|
||||||
throw new Error("invalid download url");
|
throw new Error("invalid download url");
|
||||||
@@ -99,9 +103,9 @@ export function UsageDialog({
|
|||||||
dialogRef.current?.close();
|
dialogRef.current?.close();
|
||||||
idempotencyKeyRef.current = null;
|
idempotencyKeyRef.current = null;
|
||||||
} catch {
|
} catch {
|
||||||
setError(
|
// Network failure / response not JSON — the server-code cases are
|
||||||
"Der Download konnte nicht vorbereitet werden. Versuchen Sie dieselbe Anfrage erneut.",
|
// handled above; this is only a transport-level failure.
|
||||||
);
|
setError("Der Download konnte nicht vorbereitet werden (Netzwerkfehler). Versuchen Sie es erneut.");
|
||||||
} finally {
|
} finally {
|
||||||
setPending(false);
|
setPending(false);
|
||||||
}
|
}
|
||||||
@@ -220,3 +224,39 @@ function formatDate(value: string): string {
|
|||||||
function isLocalDownloadUrl(fileUrl: string, downloadId: string): boolean {
|
function isLocalDownloadUrl(fileUrl: string, downloadId: string): boolean {
|
||||||
return fileUrl === `/api/downloads/${encodeURIComponent(downloadId)}/file`;
|
return fileUrl === `/api/downloads/${encodeURIComponent(downloadId)}/file`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function readErrorCode(response: Response): Promise<string | null> {
|
||||||
|
try {
|
||||||
|
const data = (await response.json()) as { code?: unknown };
|
||||||
|
return typeof data.code === "string" ? data.code : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map the server's stable error codes (see intent-handler.ts) to specific
|
||||||
|
// German messages so the editorial sees the real reason instead of a generic
|
||||||
|
// "try again". The fallback includes the raw code so unmapped failures are
|
||||||
|
// still actionable when reported back.
|
||||||
|
function downloadErrorMessage(code: string | null, status: number): string {
|
||||||
|
switch (code) {
|
||||||
|
case "FORBIDDEN":
|
||||||
|
return "Ihr Konto ist nicht freigegeben oder gesperrt.";
|
||||||
|
case "INVALID_REQUEST":
|
||||||
|
return "Die Anfrage war unvollständig. Bitte laden Sie die Seite neu und versuchen Sie es erneut.";
|
||||||
|
case "IDEMPOTENCY_CONFLICT":
|
||||||
|
return "Dieser Download wurde bereits registriert. Bitte laden Sie die Seite neu.";
|
||||||
|
case "NOT_FOUND":
|
||||||
|
return "Das Bild ist nicht im freigegebenen Album enthalten oder wurde daraus entfernt.";
|
||||||
|
case "UPSTREAM_UNAVAILABLE":
|
||||||
|
return "Immich ist momentan nicht erreichbar. Bitte versuchen Sie es in wenigen Minuten erneut.";
|
||||||
|
case "INVALID_ASSET":
|
||||||
|
return "Dieses Asset ist kein Bild und kann nicht lizenziert werden.";
|
||||||
|
case "ACCOUNTING_UNAVAILABLE":
|
||||||
|
return "Für Ihr Konto ist noch kein Preis hinterlegt. Bitte den Admin, einen Preis festzulegen.";
|
||||||
|
case "CROSS_ORIGIN_REQUEST":
|
||||||
|
return "Die Anfrage wurde aus einer unzulässigen Herkunft gestellt.";
|
||||||
|
default:
|
||||||
|
return `Download fehlgeschlagen (Code ${code ?? status}). Bitte erneut versuchen.`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,29 +8,30 @@ import type { VisibleAlbum } from "./catalog";
|
|||||||
|
|
||||||
export function AlbumContactSheet({ albums }: Readonly<{ albums: VisibleAlbum[] }>) {
|
export function AlbumContactSheet({ albums }: Readonly<{ albums: VisibleAlbum[] }>) {
|
||||||
return (
|
return (
|
||||||
<ul className="album-contact-sheet" aria-label="Freigegebene Fotoalben">
|
<ul className="album-gallery" aria-label="Freigegebene Fotoalben">
|
||||||
{albums.map((album) => (
|
{albums.map((album) => (
|
||||||
<li key={album.id}>
|
<li key={album.id}>
|
||||||
<Link className="contact-sheet-link" href={`/redaktion/alben/${encodeURIComponent(album.id)}`}>
|
<Link className="album-tile" href={`/redaktion/alben/${encodeURIComponent(album.id)}`}>
|
||||||
<article className="album-contact-frame">
|
<figure className="album-tile-frame">
|
||||||
{album.albumThumbnailAssetId ? (
|
{album.albumThumbnailAssetId ? (
|
||||||
<img
|
<img
|
||||||
alt={`Titelbild: ${album.albumName}`}
|
alt={`Titelbild: ${album.albumName}`}
|
||||||
className="contact-sheet-image"
|
className="album-tile-image"
|
||||||
height="480"
|
loading="lazy"
|
||||||
src={thumbnailUrl(album.albumThumbnailAssetId)}
|
src={thumbnailUrl(album.albumThumbnailAssetId)}
|
||||||
width="720"
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div aria-label={`Kein Titelbild für ${album.albumName}`} className="missing-contact-image" role="img">
|
<div aria-label={`Kein Titelbild für ${album.albumName}`} className="album-tile-missing" role="img">
|
||||||
Kein Titelbild
|
Kein Titelbild
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<footer className="contact-strip">
|
<div className="album-tile-overlay">
|
||||||
<span className="contact-strip-name">{album.albumName}</span>
|
<figcaption className="photo-tile-caption">
|
||||||
<span>{formatCount(album.assetCount, "Foto")}</span>
|
<span className="photo-tile-name">{album.albumName}</span>
|
||||||
</footer>
|
<span className="photo-tile-date">{formatCount(album.assetCount, "Foto")}</span>
|
||||||
</article>
|
</figcaption>
|
||||||
|
</div>
|
||||||
|
</figure>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in new issue
Block a user