-
0}
+
{/if}
@@ -108,32 +129,10 @@
font-weight: 400;
}
- .album-cover {
+ .album-slideshow {
position: relative;
width: 100%;
- height: 200px;
- border-radius: $unit;
- overflow: hidden;
margin-bottom: $unit-3x;
- background: $grey-95;
-
- img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
-
- .photo-count-overlay {
- position: absolute;
- bottom: $unit;
- right: $unit;
- background: rgba(0, 0, 0, 0.8);
- color: white;
- padding: $unit-half $unit-2x;
- border-radius: 50px;
- font-size: 0.75rem;
- font-weight: 500;
- }
}
.album-info {
diff --git a/src/routes/api/posts/by-slug/[slug]/+server.ts b/src/routes/api/posts/by-slug/[slug]/+server.ts
index bf32b65..738cf44 100644
--- a/src/routes/api/posts/by-slug/[slug]/+server.ts
+++ b/src/routes/api/posts/by-slug/[slug]/+server.ts
@@ -20,7 +20,18 @@ export const GET: RequestHandler = async (event) => {
id: true,
slug: true,
title: true,
- description: true
+ description: true,
+ photos: {
+ orderBy: { displayOrder: 'asc' },
+ select: {
+ id: true,
+ url: true,
+ thumbnailUrl: true,
+ caption: true,
+ width: true,
+ height: true
+ }
+ }
}
},
photo: {
diff --git a/src/routes/api/universe/+server.ts b/src/routes/api/universe/+server.ts
index f652fd4..85edc61 100644
--- a/src/routes/api/universe/+server.ts
+++ b/src/routes/api/universe/+server.ts
@@ -25,6 +25,7 @@ export interface UniverseItem {
date?: string
photosCount?: number
coverPhoto?: any
+ photos?: any[]
}
// GET /api/universe - Get mixed feed of published posts and albums
@@ -74,13 +75,15 @@ export const GET: RequestHandler = async (event) => {
select: { photos: true }
},
photos: {
- take: 1,
+ take: 6, // Fetch enough for 5 thumbnails + 1 background
orderBy: { displayOrder: 'asc' },
select: {
id: true,
url: true,
thumbnailUrl: true,
- caption: true
+ caption: true,
+ width: true,
+ height: true
}
}
},
@@ -114,7 +117,8 @@ export const GET: RequestHandler = async (event) => {
location: album.location || undefined,
date: album.date?.toISOString(),
photosCount: album._count.photos,
- coverPhoto: album.photos[0] || null,
+ coverPhoto: album.photos[0] || null, // Keep for backward compatibility
+ photos: album.photos, // Add all photos for slideshow
publishedAt: album.createdAt.toISOString(), // Albums use createdAt as publishedAt
createdAt: album.createdAt.toISOString()
}))
{items[selectedIndex].caption}
+ {/if}
+