Rename film params

This commit is contained in:
Sam Becker 2025-03-29 22:44:44 -05:00
parent 763428547c
commit 535f2180c2
3 changed files with 22 additions and 19 deletions

View File

@ -28,22 +28,22 @@ const getPhotosNearIdCachedCached = cache((
));
interface PhotoFilmSimulationProps {
params: Promise<{ photoId: string, simulation: FilmSimulation }>
params: Promise<{ photoId: string, film: FilmSimulation }>
}
export async function generateMetadata({
params,
}: PhotoFilmSimulationProps): Promise<Metadata> {
const { photoId, simulation } = await params;
const { photoId, film } = await params;
const { photo } = await getPhotosNearIdCachedCached(photoId, simulation);
const { photo } = await getPhotosNearIdCachedCached(photoId, film);
if (!photo) { return {}; }
const title = titleForPhoto(photo);
const description = descriptionForPhoto(photo);
const images = absolutePathForPhotoImage(photo);
const url = absolutePathForPhoto({ photo, simulation });
const url = absolutePathForPhoto({ photo, simulation: film });
return {
title,
@ -66,21 +66,21 @@ export async function generateMetadata({
export default async function PhotoFilmPage({
params,
}: PhotoFilmSimulationProps) {
const { photoId, simulation } = await params;
const { photoId, film } = await params;
const { photo, photos, photosGrid, indexNumber } =
await getPhotosNearIdCachedCached(photoId, simulation);
await getPhotosNearIdCachedCached(photoId, film);
if (!photo) { redirect(PATH_ROOT); }
const { count, dateRange } = await getPhotosMetaCached({ simulation });
const { count, dateRange } = await getPhotosMetaCached({ simulation: film });
return (
<PhotoDetailPage {...{
photo,
photos,
photosGrid,
simulation,
simulation: film,
indexNumber,
count,
dateRange,

View File

@ -21,16 +21,19 @@ export const generateStaticParams = staticallyGenerateCategoryIfConfigured(
export async function GET(
_: Request,
context: { params: Promise<{ simulation: FilmSimulation }> },
context: { params: Promise<{ film: FilmSimulation }> },
) {
const { simulation } = await context.params;
const { film } = await context.params;
const [
photos,
{ fontFamily, fonts },
headers,
] = await Promise.all([
getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_PER_CATEGORY, simulation }),
getPhotosCached({
limit: MAX_PHOTOS_TO_SHOW_PER_CATEGORY,
simulation: film,
}),
getIBMPlexMono(),
getImageResponseCacheControlHeaders(),
]);
@ -39,7 +42,7 @@ export async function GET(
return new ImageResponse(
<FilmImageResponse {...{
simulation,
simulation: film,
photos,
width,
height,

View File

@ -20,19 +20,19 @@ export const generateStaticParams = staticallyGenerateCategoryIfConfigured(
);
interface FilmSimulationProps {
params: Promise<{ simulation: FilmSimulation }>
params: Promise<{ film: FilmSimulation }>
}
export async function generateMetadata({
params,
}: FilmSimulationProps): Promise<Metadata> {
const { simulation } = await params;
const { film } = await params;
const [
photos,
{ count, dateRange },
] = await getPhotosFilmSimulationDataCachedCached({
simulation,
simulation: film,
limit: INFINITE_SCROLL_GRID_INITIAL,
});
@ -43,7 +43,7 @@ export async function generateMetadata({
title,
description,
images,
} = generateMetaForFilmSimulation(simulation, photos, count, dateRange);
} = generateMetaForFilmSimulation(film, photos, count, dateRange);
return {
title,
@ -65,13 +65,13 @@ export async function generateMetadata({
export default async function FilmPage({
params,
}: FilmSimulationProps) {
const { simulation } = await params;
const { film } = await params;
const [
photos,
{ count, dateRange },
] = await getPhotosFilmSimulationDataCachedCached({
simulation,
simulation: film,
limit: INFINITE_SCROLL_GRID_INITIAL,
});
@ -79,7 +79,7 @@ export default async function FilmPage({
return (
<FilmOverview {...{
simulation,
simulation: film,
photos,
count,
dateRange,