feat: add branded editorial photo catalog
This commit is contained in:
1 parent
f6e6018cc1
commit
66f0599653
20 files changed
+1299
-36
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import { AlbumCatalogError, albumCatalog } from "@/modules/albums/catalog";
|
||||
import { AlbumContactSheet } from "@/modules/albums/catalog-content";
|
||||
|
||||
import { requireEditorial } from "../access";
|
||||
|
||||
export default async function AlbumsPage() {
|
||||
const principal = await requireEditorial();
|
||||
const result = await loadAlbums(principal.editorialId);
|
||||
|
||||
if (result.unavailable) {
|
||||
return <ImmichUnavailable />;
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="editorial-section" aria-labelledby="albums-title">
|
||||
<p className="editorial-kicker">Bildarchiv · Freigaben</p>
|
||||
<div className="editorial-title-row">
|
||||
<h1 id="albums-title">Ihre Alben</h1>
|
||||
<p>Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.</p>
|
||||
</div>
|
||||
{result.albums.length === 0 ? (
|
||||
<p className="catalog-empty">Für Ihre Redaktion sind noch keine Fotoalben freigegeben.</p>
|
||||
) : (
|
||||
<AlbumContactSheet albums={result.albums} />
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
async function loadAlbums(editorialId: string) {
|
||||
try {
|
||||
return { albums: await albumCatalog.getVisibleAlbums(editorialId), unavailable: false as const };
|
||||
} catch (error) {
|
||||
if (error instanceof AlbumCatalogError && error.code === "IMMICH_UNAVAILABLE") {
|
||||
return { albums: [], unavailable: true as const };
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function ImmichUnavailable() {
|
||||
return (
|
||||
<section className="editorial-section editorial-state" aria-labelledby="albums-title">
|
||||
<p className="editorial-kicker">Bildarchiv</p>
|
||||
<h1 id="albums-title">Alben momentan nicht erreichbar</h1>
|
||||
<p role="status">Bitte laden Sie diese Seite in wenigen Minuten erneut. Ihre Freigaben bleiben unverändert.</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user