From 535f2180c22aa3ae1503faa53e716d0a7e7aff2b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 29 Mar 2025 22:44:44 -0500 Subject: [PATCH] Rename film params --- .../{[simulation] => [film]}/[photoId]/page.tsx | 16 ++++++++-------- .../{[simulation] => [film]}/image/route.tsx | 11 +++++++---- app/film/{[simulation] => [film]}/page.tsx | 14 +++++++------- 3 files changed, 22 insertions(+), 19 deletions(-) rename app/film/{[simulation] => [film]}/[photoId]/page.tsx (80%) rename app/film/{[simulation] => [film]}/image/route.tsx (84%) rename app/film/{[simulation] => [film]}/page.tsx (87%) diff --git a/app/film/[simulation]/[photoId]/page.tsx b/app/film/[film]/[photoId]/page.tsx similarity index 80% rename from app/film/[simulation]/[photoId]/page.tsx rename to app/film/[film]/[photoId]/page.tsx index 80eae0ed..b0144da9 100644 --- a/app/film/[simulation]/[photoId]/page.tsx +++ b/app/film/[film]/[photoId]/page.tsx @@ -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 { - 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 ( }, + 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( + params: Promise<{ film: FilmSimulation }> } export async function generateMetadata({ params, }: FilmSimulationProps): Promise { - 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 (