Temporarily simplify static page generation

This commit is contained in:
Sam Becker 2024-01-22 20:06:12 -06:00
parent bc4b959cd5
commit bb75df4832

View File

@ -1,5 +1,5 @@
import { import {
GRID_THUMBNAILS_TO_SHOW_MAX, // GRID_THUMBNAILS_TO_SHOW_MAX,
descriptionForPhoto, descriptionForPhoto,
titleForPhoto, titleForPhoto,
} from '@/photo'; } from '@/photo';
@ -13,7 +13,7 @@ import {
import PhotoDetailPage from '@/photo/PhotoDetailPage'; import PhotoDetailPage from '@/photo/PhotoDetailPage';
import { import {
getPhotoCached, getPhotoCached,
getPhotosNearIdCached, // getPhotosNearIdCached,
} from '@/cache'; } from '@/cache';
import { getPhotoIds } from '@/services/vercel-postgres'; import { getPhotoIds } from '@/services/vercel-postgres';
@ -60,28 +60,31 @@ export default async function PhotoPage({
params: { photoId }, params: { photoId },
children, children,
}: PhotoProps & { children: React.ReactNode }) { }: PhotoProps & { children: React.ReactNode }) {
const photos = await getPhotosNearIdCached( // const photos = await getPhotosNearIdCached(
photoId, // photoId,
GRID_THUMBNAILS_TO_SHOW_MAX + 2, // GRID_THUMBNAILS_TO_SHOW_MAX + 2,
); // );
const photo = photos.find(p => p.id === photoId); const photo = await getPhotoCached(photoId);
// const photo = photos.find(p => p.id === photoId);
if (!photo) { redirect(PATH_ROOT); } if (!photo) { redirect(PATH_ROOT); }
const isPhotoFirst = photos.findIndex(p => p.id === photoId) === 0; // const isPhotoFirst = photos.findIndex(p => p.id === photoId) === 0;
return <> return <>
{children} {children}
<PhotoDetailPage <PhotoDetailPage
photo={photo} photo={photo}
photos={photos} // photos={photos}
photosGrid={photos.slice( photos={[]}
isPhotoFirst ? 1 : 2, // photosGrid={photos.slice(
isPhotoFirst // isPhotoFirst ? 1 : 2,
? GRID_THUMBNAILS_TO_SHOW_MAX + 1 // isPhotoFirst
: GRID_THUMBNAILS_TO_SHOW_MAX + 2, // ? GRID_THUMBNAILS_TO_SHOW_MAX + 1
)} // : GRID_THUMBNAILS_TO_SHOW_MAX + 2,
// )}
/> />
</>; </>;
} }