From 20f8b38c8a937c0e6d41313da5734844be507198 Mon Sep 17 00:00:00 2001 From: June Date: Sat, 22 Nov 2025 15:18:57 +1300 Subject: [PATCH] Add detail page for album --- web/src/pages/albums/[title].astro | 29 +++++++++++++++++++++++++++++ web/src/pages/albums/index.astro | 16 +++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 web/src/pages/albums/[title].astro diff --git a/web/src/pages/albums/[title].astro b/web/src/pages/albums/[title].astro new file mode 100644 index 0000000..37a3acd --- /dev/null +++ b/web/src/pages/albums/[title].astro @@ -0,0 +1,29 @@ +--- +import Base from "@layout/Base"; +import { authPB } from "@utils/pocketbase"; +export const prerender = false + +const { title } = Astro.params +const pb = await authPB() +const album = await pb.collection('albums').getFirstListItem(`title ~ "${decodeURI(title!)}"`) +const images = await Promise.all( + album.images.map(i => pb.files.getURL(album, i)) +) +--- + + + +
+

{album.title}

+

{album.date}

+

{album.location}

+
+ +
+ { + images.map(img => ( + + )) + } +
+ diff --git a/web/src/pages/albums/index.astro b/web/src/pages/albums/index.astro index 08fe07a..63b739f 100644 --- a/web/src/pages/albums/index.astro +++ b/web/src/pages/albums/index.astro @@ -41,13 +41,15 @@ const albums = await pb.collection('albums').getFullList({ { albums.map(a => (
-

{a.title}

-

{a.date}

- {a.title} + +

{a.title}

+

{a.date}

+ {a.title} +
)) }