Fix photo detail thumbnail count

This commit is contained in:
Sam Becker 2023-12-24 15:44:08 -05:00
parent fa998b6dc2
commit 1ef6e8a29a

View File

@ -60,14 +60,19 @@ export default async function PhotoPage({
if (!photo) { redirect(PATH_ROOT); }
const index = photos.findIndex(p => p.id === photoId);
const isPhotoFirst = photos.findIndex(p => p.id === photoId) === 0;
return <>
{children}
<PhotoDetailPage
photo={photo}
photos={photos}
photosGrid={photos.slice(index === 0 ? 1 : 2)}
photosGrid={photos.slice(
isPhotoFirst ? 1 : 2,
isPhotoFirst
? GRID_THUMBNAILS_TO_SHOW_MAX + 1
: GRID_THUMBNAILS_TO_SHOW_MAX + 2,
)}
/>
</>;
}