From 3ec5f7754279ab63df34aae7aa71f71b3502a77c Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 15 Mar 2025 16:46:39 -0500 Subject: [PATCH] Add lenses to visibility configuration --- src/app/config.ts | 2 ++ src/lens/PhotoLens.tsx | 2 +- src/photo/PhotoLarge.tsx | 60 +++++++++++++++++++--------------------- src/photo/index.ts | 17 ++++++++++-- src/photo/set.ts | 1 - 5 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/app/config.ts b/src/app/config.ts index a2569bf8..63eee4bb 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -210,6 +210,8 @@ export const MATTE_PHOTOS = export const CATEGORY_VISIBILITY = getOrderedCategoriesFromString( process.env.NEXT_PUBLIC_CATEGORY_VISIBILITY); +export const SHOW_LENSES = + CATEGORY_VISIBILITY.includes('lenses'); export const SHOW_RECIPES = CATEGORY_VISIBILITY.includes('recipes'); export const SHOW_FILM_SIMULATIONS = diff --git a/src/lens/PhotoLens.tsx b/src/lens/PhotoLens.tsx index f50ebcbe..42f1e0dc 100644 --- a/src/lens/PhotoLens.tsx +++ b/src/lens/PhotoLens.tsx @@ -23,7 +23,7 @@ export default function PhotoLens({ label={formatLensText(lens)} href={pathForLens(lens)} icon={} type={type} className={className} diff --git a/src/photo/PhotoLarge.tsx b/src/photo/PhotoLarge.tsx index 987530a6..30a83f2c 100644 --- a/src/photo/PhotoLarge.tsx +++ b/src/photo/PhotoLarge.tsx @@ -7,6 +7,7 @@ import { shouldShowCameraDataForPhoto, shouldShowExifDataForPhoto, shouldShowLensDataForPhoto, + shouldShowRecipeDataForPhoto, titleForPhoto, } from '.'; import SiteGrid from '@/components/SiteGrid'; @@ -27,8 +28,6 @@ import { SHOULD_PREFETCH_ALL_LINKS, ALLOW_PUBLIC_DOWNLOADS, SHOW_TAKEN_AT_TIME, - SHOW_RECIPES, - SHOW_FILM_SIMULATIONS, } from '@/app/config'; import AdminPhotoMenuClient from '@/admin/AdminPhotoMenuClient'; import { RevalidatePhoto } from './InfinitePhotoScroll'; @@ -127,13 +126,15 @@ export default function PhotoLarge({ const camera = cameraFromPhoto(photo); const lens = lensFromPhoto(photo); - const { recipeTitle: recipe } = photo; + const { recipeTitle } = photo; + + const showExifContent = shouldShowExifDataForPhoto(photo); const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo); const showLensContent = showLens && shouldShowLensDataForPhoto(photo); - const showRecipeContent = showRecipe && recipe; + const showRecipeContent = showRecipe && shouldShowRecipeDataForPhoto(photo); + const showRecipeButton = shouldShowRecipeDataForPhoto(photo); const showTagsContent = tags.length > 0; - const showExifContent = shouldShowExifDataForPhoto(photo); useVisible({ ref, onVisible }); @@ -147,6 +148,7 @@ export default function PhotoLarge({ const hasMetaContent = showCameraContent || + showLensContent || showTagsContent || showRecipeContent || showExifContent; @@ -224,17 +226,6 @@ export default function PhotoLarge({ 'flex items-center justify-center aspect-3/2 bg-gray-100', ); - const shouldRenderSimulation = ( - SHOW_FILM_SIMULATIONS && - showSimulation && - photo.filmSimulation - ); - - const shouldRenderRecipe = ( - SHOW_RECIPES && - photo.recipeData - ); - return ( {photo.caption} } - {(showCameraContent || showRecipeContent || showTagsContent) && + {( + showCameraContent || + showLensContent || + showRecipeContent || + showTagsContent + ) &&
{showCameraContent && } {showLensContent && - <> -
- - } - {showRecipeContent && + <> +
+ + } + {showRecipeContent && recipeTitle && } @@ -359,14 +355,14 @@ export default function PhotoLarge({
  • {photo.isoFormatted}
  • {photo.exposureCompensationFormatted ?? '0ev'}
  • - {(shouldRenderSimulation || shouldRenderRecipe) && + {(showSimulation || showRecipeButton) &&
    - {shouldRenderSimulation && photo.filmSimulation && + {showSimulation && photo.filmSimulation && } - {shouldRenderRecipe && + {showRecipeButton &&