From 4b9077fa9c26aaefb55077a17c6cc3198832a3d3 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Tue, 18 Mar 2025 21:14:37 -0500 Subject: [PATCH] Move static generation utility file --- app/film/[simulation]/image/route.tsx | 2 +- app/film/[simulation]/page.tsx | 2 +- app/focal/[focal]/image/route.tsx | 2 +- app/focal/[focal]/page.tsx | 2 +- app/lens/[make]/[model]/image/route.tsx | 2 +- app/lens/[make]/[model]/page.tsx | 2 +- app/p/[photoId]/image/route.tsx | 2 +- app/p/[photoId]/page.tsx | 2 +- app/recipe/[recipe]/image/route.tsx | 2 +- app/recipe/[recipe]/page.tsx | 2 +- app/shot-on/[make]/[model]/image/route.tsx | 2 +- app/shot-on/[make]/[model]/page.tsx | 2 +- app/tag/[tag]/image/route.tsx | 2 +- app/tag/[tag]/page.tsx | 2 +- src/{category/server.ts => app/static.ts} | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) rename src/{category/server.ts => app/static.ts} (97%) diff --git a/app/film/[simulation]/image/route.tsx b/app/film/[simulation]/image/route.tsx index dd8cd57f..097941ee 100644 --- a/app/film/[simulation]/image/route.tsx +++ b/app/film/[simulation]/image/route.tsx @@ -10,7 +10,7 @@ import { getIBMPlexMono } from '@/app/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { getUniqueFilmSimulations } from '@/photo/db/query'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'films', diff --git a/app/film/[simulation]/page.tsx b/app/film/[simulation]/page.tsx index 79349f54..283a2dd6 100644 --- a/app/film/[simulation]/page.tsx +++ b/app/film/[simulation]/page.tsx @@ -7,7 +7,7 @@ import { Metadata } from 'next/types'; import { cache } from 'react'; import { PATH_ROOT } from '@/app/paths'; import { redirect } from 'next/navigation'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; const getPhotosFilmSimulationDataCachedCached = cache(getPhotosFilmSimulationDataCached); diff --git a/app/focal/[focal]/image/route.tsx b/app/focal/[focal]/image/route.tsx index 516861f5..11076633 100644 --- a/app/focal/[focal]/image/route.tsx +++ b/app/focal/[focal]/image/route.tsx @@ -10,7 +10,7 @@ import FocalLengthImageResponse from '@/image-response/FocalLengthImageResponse'; import { formatFocalLength, getFocalLengthFromString } from '@/focal'; import { getUniqueFocalLengths } from '@/photo/db/query'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'focal-lengths', diff --git a/app/focal/[focal]/page.tsx b/app/focal/[focal]/page.tsx index 5a561d65..42db01b2 100644 --- a/app/focal/[focal]/page.tsx +++ b/app/focal/[focal]/page.tsx @@ -7,7 +7,7 @@ import { PATH_ROOT } from '@/app/paths'; import type { Metadata } from 'next'; import { redirect } from 'next/navigation'; import { cache } from 'react'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; const getPhotosFocalDataCachedCached = cache((focal: number) => getPhotosFocalLengthDataCached({ diff --git a/app/lens/[make]/[model]/image/route.tsx b/app/lens/[make]/[model]/image/route.tsx index 1867b4d1..3b90b86b 100644 --- a/app/lens/[make]/[model]/image/route.tsx +++ b/app/lens/[make]/[model]/image/route.tsx @@ -13,7 +13,7 @@ import { safelyGenerateLensStaticParams, } from '@/lens'; import LensImageResponse from '@/image-response/LensImageResponse'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'lenses', diff --git a/app/lens/[make]/[model]/page.tsx b/app/lens/[make]/[model]/page.tsx index 9dd2eec1..00953ff5 100644 --- a/app/lens/[make]/[model]/page.tsx +++ b/app/lens/[make]/[model]/page.tsx @@ -12,7 +12,7 @@ import { } from '@/lens'; import { staticallyGenerateCategoryIfConfigured, -} from '@/category/server'; +} from '@/app/static'; const getPhotosLensDataCachedCached = cache(( make: string | undefined, diff --git a/app/p/[photoId]/image/route.tsx b/app/p/[photoId]/image/route.tsx index 366c7294..b70c6a89 100644 --- a/app/p/[photoId]/image/route.tsx +++ b/app/p/[photoId]/image/route.tsx @@ -5,7 +5,7 @@ import { getIBMPlexMono } from '@/app/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { isNextImageReadyBasedOnPhotos } from '@/photo'; -import { staticallyGeneratePhotosIfConfigured } from '@/category/server'; +import { staticallyGeneratePhotosIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGeneratePhotosIfConfigured( 'image', diff --git a/app/p/[photoId]/page.tsx b/app/p/[photoId]/page.tsx index 6f8f55f9..eff3e204 100644 --- a/app/p/[photoId]/page.tsx +++ b/app/p/[photoId]/page.tsx @@ -13,7 +13,7 @@ import { import PhotoDetailPage from '@/photo/PhotoDetailPage'; import { getPhotosNearIdCached } from '@/photo/cache'; import { cache } from 'react'; -import { staticallyGeneratePhotosIfConfigured } from '@/category/server'; +import { staticallyGeneratePhotosIfConfigured } from '@/app/static'; export const maxDuration = 60; diff --git a/app/recipe/[recipe]/image/route.tsx b/app/recipe/[recipe]/image/route.tsx index 7e53acd5..74868273 100644 --- a/app/recipe/[recipe]/image/route.tsx +++ b/app/recipe/[recipe]/image/route.tsx @@ -8,7 +8,7 @@ import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { getUniqueRecipes } from '@/photo/db/query'; import RecipeImageResponse from '@/image-response/RecipeImageResponse'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'recipes', diff --git a/app/recipe/[recipe]/page.tsx b/app/recipe/[recipe]/page.tsx index 7aae7a58..84657919 100644 --- a/app/recipe/[recipe]/page.tsx +++ b/app/recipe/[recipe]/page.tsx @@ -7,7 +7,7 @@ import { cache } from 'react'; import { generateMetaForRecipe } from '@/recipe'; import RecipeOverview from '@/recipe/RecipeOverview'; import { getPhotosRecipeDataCached } from '@/recipe/data'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; const getPhotosRecipeDataCachedCached = cache(getPhotosRecipeDataCached); diff --git a/app/shot-on/[make]/[model]/image/route.tsx b/app/shot-on/[make]/[model]/image/route.tsx index e1f6b368..90d00979 100644 --- a/app/shot-on/[make]/[model]/image/route.tsx +++ b/app/shot-on/[make]/[model]/image/route.tsx @@ -9,7 +9,7 @@ import { getIBMPlexMono } from '@/app/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { getUniqueCameras } from '@/photo/db/query'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'cameras', diff --git a/app/shot-on/[make]/[model]/page.tsx b/app/shot-on/[make]/[model]/page.tsx index 85d4bd1f..b25a0553 100644 --- a/app/shot-on/[make]/[model]/page.tsx +++ b/app/shot-on/[make]/[model]/page.tsx @@ -6,7 +6,7 @@ import { getPhotosCameraDataCached } from '@/camera/data'; import CameraOverview from '@/camera/CameraOverview'; import { cache } from 'react'; import { getUniqueCameras } from '@/photo/db/query'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; const getPhotosCameraDataCachedCached = cache(( make: string, diff --git a/app/tag/[tag]/image/route.tsx b/app/tag/[tag]/image/route.tsx index 48e11d83..ccd59e5c 100644 --- a/app/tag/[tag]/image/route.tsx +++ b/app/tag/[tag]/image/route.tsx @@ -8,7 +8,7 @@ import { getIBMPlexMono } from '@/app/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { getUniqueTags } from '@/photo/db/query'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; export const generateStaticParams = staticallyGenerateCategoryIfConfigured( 'tags', diff --git a/app/tag/[tag]/page.tsx b/app/tag/[tag]/page.tsx index ab090c2c..1058c1f0 100644 --- a/app/tag/[tag]/page.tsx +++ b/app/tag/[tag]/page.tsx @@ -7,7 +7,7 @@ import { getPhotosTagDataCached } from '@/tag/data'; import type { Metadata } from 'next'; import { redirect } from 'next/navigation'; import { cache } from 'react'; -import { staticallyGenerateCategoryIfConfigured } from '@/category/server'; +import { staticallyGenerateCategoryIfConfigured } from '@/app/static'; const getPhotosTagDataCachedCached = cache((tag: string) => getPhotosTagDataCached({ tag, limit: INFINITE_SCROLL_GRID_INITIAL})); diff --git a/src/category/server.ts b/src/app/static.ts similarity index 97% rename from src/category/server.ts rename to src/app/static.ts index eb2d2842..b90cb6c0 100644 --- a/src/category/server.ts +++ b/src/app/static.ts @@ -1,4 +1,4 @@ -import { CategoryKey } from '.'; +import { CategoryKey } from '../category'; import { CATEGORY_VISIBILITY, IS_BUILDING,