From 091fbb2c9769e54ce245e5a4942f52b2767e7818 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Mon, 12 Aug 2024 13:55:54 -0400 Subject: [PATCH] Offer configuration for hiding 'untitled' fallback text --- README.md | 1 + src/photo/PhotoLarge.tsx | 43 +++++++++++++++++++++++++------- src/site/SiteChecklistClient.tsx | 20 +++++++++++---- src/site/config.ts | 3 +++ src/site/globals.css | 4 +++ 5 files changed, 57 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f8848593..d17f0283 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ Application behavior can be changed by configuring the following environment var - `NEXT_PUBLIC_MATTE_PHOTOS = 1` constrains the size of each photo, and enables a surrounding border (potentially useful for photos with tall aspect ratios) - `NEXT_PUBLIC_BLUR_DISABLED = 1` prevents image blur data being stored and displayed (potentially useful for limiting Postgres usage) - `NEXT_PUBLIC_GEO_PRIVACY = 1` disables collection/display of location-based data (⚠️ re-compresses uploaded images in order to remove GPS information) +- `NEXT_PUBLIC_HIDE_TITLE_FALLBACK_TEXT = 1` prevents showing "Untitled" for photos without titles - `NEXT_PUBLIC_IGNORE_PRIORITY_ORDER = 1` prevents `priority_order` field affecting photo order - `NEXT_PUBLIC_PUBLIC_API = 1` enables public API available at `/api` - `NEXT_PUBLIC_HIDE_REPO_LINK = 1` removes footer link to repo diff --git a/src/photo/PhotoLarge.tsx b/src/photo/PhotoLarge.tsx index 3e561573..cda6ac5b 100644 --- a/src/photo/PhotoLarge.tsx +++ b/src/photo/PhotoLarge.tsx @@ -25,7 +25,10 @@ import PhotoFilmSimulation from '@/simulation/PhotoFilmSimulation'; import { sortTags } from '@/tag'; import DivDebugBaselineGrid from '@/components/DivDebugBaselineGrid'; import PhotoLink from './PhotoLink'; -import { SHOULD_PREFETCH_ALL_LINKS } from '@/site/config'; +import { + SHOULD_PREFETCH_ALL_LINKS, + SHOW_PHOTO_TITLE_FALLBACK_TEXT, +} from '@/site/config'; import AdminPhotoMenuClient from '@/admin/AdminPhotoMenuClient'; import { RevalidatePhoto } from './InfinitePhotoScroll'; import { useRef } from 'react'; @@ -80,7 +83,21 @@ export default function PhotoLarge({ useOnVisible(ref, onVisible); - const { arePhotosMatted } = useAppState(); + const { arePhotosMatted, isUserSignedIn } = useAppState(); + + const hasTitleContent = + photo.title || + SHOW_PHOTO_TITLE_FALLBACK_TEXT || + photo.caption; + + const hasMetaContent = + showCameraContent || + showTagsContent || + showExifContent; + + const hasNonDateContent = + hasTitleContent || + hasMetaContent; return (
- + {(photo.title || SHOW_PHOTO_TITLE_FALLBACK_TEXT) && + }
{/* EXIF Data */} -
+
{showExifContent && <>
    @@ -201,7 +222,11 @@ export default function PhotoLarge({ )}> {shouldShare && Comma-separated fields to auto-generate when uploading photos. Accepted values: title, caption, - tags, description, all, or none (default is {'"all"'}). + tags, description, all, or none (default is {'"all"'}): {renderEnvVars(['AI_TEXT_AUTO_GENERATED_FIELDS'])} @@ -491,7 +492,7 @@ export default function SiteChecklistClient({ optional > Set environment variable to {'"1"'} to prevent - image blur data being stored and displayed + image blur data being stored and displayed: {renderEnvVars(['NEXT_PUBLIC_BLUR_DISABLED'])} Set environment variable to {'"1"'} to disable - collection/display of location-based data + collection/display of location-based data: {renderEnvVars(['NEXT_PUBLIC_GEO_PRIVACY'])} + + Set environment variable to {'"1"'} to prevent + showing {'"Untitled"'} for photos without titles: + {renderEnvVars(['NEXT_PUBLIC_HIDE_TITLE_FALLBACK_TEXT'])} + Set environment variable to {'"1"'} to prevent - priority order photo field affecting photo order + priority order photo field affecting photo order: {renderEnvVars(['NEXT_PUBLIC_IGNORE_PRIORITY_ORDER'])}