Add lenses to visibility configuration
This commit is contained in:
parent
13b6163212
commit
3ec5f77542
@ -210,6 +210,8 @@ export const MATTE_PHOTOS =
|
|||||||
|
|
||||||
export const CATEGORY_VISIBILITY = getOrderedCategoriesFromString(
|
export const CATEGORY_VISIBILITY = getOrderedCategoriesFromString(
|
||||||
process.env.NEXT_PUBLIC_CATEGORY_VISIBILITY);
|
process.env.NEXT_PUBLIC_CATEGORY_VISIBILITY);
|
||||||
|
export const SHOW_LENSES =
|
||||||
|
CATEGORY_VISIBILITY.includes('lenses');
|
||||||
export const SHOW_RECIPES =
|
export const SHOW_RECIPES =
|
||||||
CATEGORY_VISIBILITY.includes('recipes');
|
CATEGORY_VISIBILITY.includes('recipes');
|
||||||
export const SHOW_FILM_SIMULATIONS =
|
export const SHOW_FILM_SIMULATIONS =
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default function PhotoLens({
|
|||||||
label={formatLensText(lens)}
|
label={formatLensText(lens)}
|
||||||
href={pathForLens(lens)}
|
href={pathForLens(lens)}
|
||||||
icon={<TbCone
|
icon={<TbCone
|
||||||
className="rotate-[270deg] translate-x-[-0.5px]"
|
className="rotate-[270deg] translate-x-[-1px] translate-y-[-0.5px]"
|
||||||
/>}
|
/>}
|
||||||
type={type}
|
type={type}
|
||||||
className={className}
|
className={className}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import {
|
|||||||
shouldShowCameraDataForPhoto,
|
shouldShowCameraDataForPhoto,
|
||||||
shouldShowExifDataForPhoto,
|
shouldShowExifDataForPhoto,
|
||||||
shouldShowLensDataForPhoto,
|
shouldShowLensDataForPhoto,
|
||||||
|
shouldShowRecipeDataForPhoto,
|
||||||
titleForPhoto,
|
titleForPhoto,
|
||||||
} from '.';
|
} from '.';
|
||||||
import SiteGrid from '@/components/SiteGrid';
|
import SiteGrid from '@/components/SiteGrid';
|
||||||
@ -27,8 +28,6 @@ import {
|
|||||||
SHOULD_PREFETCH_ALL_LINKS,
|
SHOULD_PREFETCH_ALL_LINKS,
|
||||||
ALLOW_PUBLIC_DOWNLOADS,
|
ALLOW_PUBLIC_DOWNLOADS,
|
||||||
SHOW_TAKEN_AT_TIME,
|
SHOW_TAKEN_AT_TIME,
|
||||||
SHOW_RECIPES,
|
|
||||||
SHOW_FILM_SIMULATIONS,
|
|
||||||
} from '@/app/config';
|
} from '@/app/config';
|
||||||
import AdminPhotoMenuClient from '@/admin/AdminPhotoMenuClient';
|
import AdminPhotoMenuClient from '@/admin/AdminPhotoMenuClient';
|
||||||
import { RevalidatePhoto } from './InfinitePhotoScroll';
|
import { RevalidatePhoto } from './InfinitePhotoScroll';
|
||||||
@ -127,13 +126,15 @@ export default function PhotoLarge({
|
|||||||
|
|
||||||
const camera = cameraFromPhoto(photo);
|
const camera = cameraFromPhoto(photo);
|
||||||
const lens = lensFromPhoto(photo);
|
const lens = lensFromPhoto(photo);
|
||||||
const { recipeTitle: recipe } = photo;
|
const { recipeTitle } = photo;
|
||||||
|
|
||||||
|
const showExifContent = shouldShowExifDataForPhoto(photo);
|
||||||
|
|
||||||
const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo);
|
const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo);
|
||||||
const showLensContent = showLens && shouldShowLensDataForPhoto(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 showTagsContent = tags.length > 0;
|
||||||
const showExifContent = shouldShowExifDataForPhoto(photo);
|
|
||||||
|
|
||||||
useVisible({ ref, onVisible });
|
useVisible({ ref, onVisible });
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ export default function PhotoLarge({
|
|||||||
|
|
||||||
const hasMetaContent =
|
const hasMetaContent =
|
||||||
showCameraContent ||
|
showCameraContent ||
|
||||||
|
showLensContent ||
|
||||||
showTagsContent ||
|
showTagsContent ||
|
||||||
showRecipeContent ||
|
showRecipeContent ||
|
||||||
showExifContent;
|
showExifContent;
|
||||||
@ -224,17 +226,6 @@ export default function PhotoLarge({
|
|||||||
'flex items-center justify-center aspect-3/2 bg-gray-100',
|
'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 (
|
return (
|
||||||
<SiteGrid
|
<SiteGrid
|
||||||
containerRef={ref}
|
containerRef={ref}
|
||||||
@ -282,7 +273,12 @@ export default function PhotoLarge({
|
|||||||
)}>
|
)}>
|
||||||
{photo.caption}
|
{photo.caption}
|
||||||
</div>}
|
</div>}
|
||||||
{(showCameraContent || showRecipeContent || showTagsContent) &&
|
{(
|
||||||
|
showCameraContent ||
|
||||||
|
showLensContent ||
|
||||||
|
showRecipeContent ||
|
||||||
|
showTagsContent
|
||||||
|
) &&
|
||||||
<div>
|
<div>
|
||||||
{showCameraContent &&
|
{showCameraContent &&
|
||||||
<PhotoCamera
|
<PhotoCamera
|
||||||
@ -299,9 +295,9 @@ export default function PhotoLarge({
|
|||||||
prefetch={prefetchRelatedLinks}
|
prefetch={prefetchRelatedLinks}
|
||||||
/>
|
/>
|
||||||
</>}
|
</>}
|
||||||
{showRecipeContent &&
|
{showRecipeContent && recipeTitle &&
|
||||||
<PhotoRecipe
|
<PhotoRecipe
|
||||||
recipe={recipe}
|
recipe={recipeTitle}
|
||||||
contrast="medium"
|
contrast="medium"
|
||||||
prefetch={prefetchRelatedLinks}
|
prefetch={prefetchRelatedLinks}
|
||||||
/>}
|
/>}
|
||||||
@ -359,14 +355,14 @@ export default function PhotoLarge({
|
|||||||
<li>{photo.isoFormatted}</li>
|
<li>{photo.isoFormatted}</li>
|
||||||
<li>{photo.exposureCompensationFormatted ?? '0ev'}</li>
|
<li>{photo.exposureCompensationFormatted ?? '0ev'}</li>
|
||||||
</ul>
|
</ul>
|
||||||
{(shouldRenderSimulation || shouldRenderRecipe) &&
|
{(showSimulation || showRecipeButton) &&
|
||||||
<div className="flex items-center gap-2 *:w-auto">
|
<div className="flex items-center gap-2 *:w-auto">
|
||||||
{shouldRenderSimulation && photo.filmSimulation &&
|
{showSimulation && photo.filmSimulation &&
|
||||||
<PhotoFilmSimulation
|
<PhotoFilmSimulation
|
||||||
simulation={photo.filmSimulation}
|
simulation={photo.filmSimulation}
|
||||||
prefetch={prefetchRelatedLinks}
|
prefetch={prefetchRelatedLinks}
|
||||||
/>}
|
/>}
|
||||||
{shouldRenderRecipe &&
|
{showRecipeButton &&
|
||||||
<Tooltip content="Fujifilm Recipe">
|
<Tooltip content="Fujifilm Recipe">
|
||||||
<button
|
<button
|
||||||
ref={refRecipeButton}
|
ref={refRecipeButton}
|
||||||
@ -382,7 +378,7 @@ export default function PhotoLarge({
|
|||||||
'px-[4px] py-[2.5px] my-[-3px]',
|
'px-[4px] py-[2.5px] my-[-3px]',
|
||||||
'translate-y-[2px]',
|
'translate-y-[2px]',
|
||||||
'hover:bg-dim active:bg-main',
|
'hover:bg-dim active:bg-main',
|
||||||
!shouldRenderSimulation && 'translate-x-[-2px]',
|
!showSimulation && 'translate-x-[-2px]',
|
||||||
)}>
|
)}>
|
||||||
{shouldShowRecipeOverlay
|
{shouldShowRecipeOverlay
|
||||||
? <IoCloseSharp size={15} />
|
? <IoCloseSharp size={15} />
|
||||||
@ -434,7 +430,7 @@ export default function PhotoLarge({
|
|||||||
? photo.filmSimulation
|
? photo.filmSimulation
|
||||||
: undefined}
|
: undefined}
|
||||||
recipe={shouldShareRecipe
|
recipe={shouldShareRecipe
|
||||||
? recipe
|
? recipeTitle
|
||||||
: undefined}
|
: undefined}
|
||||||
focal={shouldShareFocalLength
|
focal={shouldShareFocalLength
|
||||||
? photo.focalLength
|
? photo.focalLength
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import {
|
|||||||
HIGH_DENSITY_GRID,
|
HIGH_DENSITY_GRID,
|
||||||
IS_PREVIEW,
|
IS_PREVIEW,
|
||||||
SHOW_EXIF_DATA,
|
SHOW_EXIF_DATA,
|
||||||
|
SHOW_LENSES,
|
||||||
|
SHOW_RECIPES,
|
||||||
} from '@/app/config';
|
} from '@/app/config';
|
||||||
import { ABSOLUTE_PATH_FOR_HOME_IMAGE } from '@/app/paths';
|
import { ABSOLUTE_PATH_FOR_HOME_IMAGE } from '@/app/paths';
|
||||||
import { formatDate, formatDateFromPostgresString } from '@/utility/date';
|
import { formatDate, formatDateFromPostgresString } from '@/utility/date';
|
||||||
@ -302,6 +304,9 @@ const photoHasLensData = (photo: Photo) =>
|
|||||||
Boolean(photo.lensMake) &&
|
Boolean(photo.lensMake) &&
|
||||||
Boolean(photo.lensModel);
|
Boolean(photo.lensModel);
|
||||||
|
|
||||||
|
const photoHasRecipeData = (photo: Photo) =>
|
||||||
|
Boolean(photo.recipeData);
|
||||||
|
|
||||||
const photoHasExifData = (photo: Photo) =>
|
const photoHasExifData = (photo: Photo) =>
|
||||||
Boolean(photo.focalLength) ||
|
Boolean(photo.focalLength) ||
|
||||||
Boolean(photo.focalLengthIn35MmFormat) ||
|
Boolean(photo.focalLengthIn35MmFormat) ||
|
||||||
@ -311,10 +316,18 @@ const photoHasExifData = (photo: Photo) =>
|
|||||||
Boolean(photo.exposureCompensationFormatted);
|
Boolean(photo.exposureCompensationFormatted);
|
||||||
|
|
||||||
export const shouldShowCameraDataForPhoto = (photo: Photo) =>
|
export const shouldShowCameraDataForPhoto = (photo: Photo) =>
|
||||||
SHOW_EXIF_DATA && photoHasCameraData(photo);
|
SHOW_EXIF_DATA &&
|
||||||
|
photoHasCameraData(photo);
|
||||||
|
|
||||||
export const shouldShowLensDataForPhoto = (photo: Photo) =>
|
export const shouldShowLensDataForPhoto = (photo: Photo) =>
|
||||||
SHOW_EXIF_DATA && photoHasLensData(photo);
|
SHOW_EXIF_DATA &&
|
||||||
|
SHOW_LENSES &&
|
||||||
|
photoHasLensData(photo);
|
||||||
|
|
||||||
|
export const shouldShowRecipeDataForPhoto = (photo: Photo) =>
|
||||||
|
SHOW_EXIF_DATA &&
|
||||||
|
SHOW_RECIPES &&
|
||||||
|
photoHasRecipeData(photo);
|
||||||
|
|
||||||
export const shouldShowExifDataForPhoto = (photo: Photo) =>
|
export const shouldShowExifDataForPhoto = (photo: Photo) =>
|
||||||
SHOW_EXIF_DATA && photoHasExifData(photo);
|
SHOW_EXIF_DATA && photoHasExifData(photo);
|
||||||
|
|||||||
@ -23,7 +23,6 @@ type CategoryKeys = CategoryKey[];
|
|||||||
export const DEFAULT_CATEGORY_KEYS: CategoryKeys = [
|
export const DEFAULT_CATEGORY_KEYS: CategoryKeys = [
|
||||||
'tags',
|
'tags',
|
||||||
'cameras',
|
'cameras',
|
||||||
'lenses',
|
|
||||||
'recipes',
|
'recipes',
|
||||||
'films',
|
'films',
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user