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

View File

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

View File

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