From 34c7ad87f193494365f6b68c3df78b3e8c747557 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Tue, 14 May 2024 17:27:40 -0500 Subject: [PATCH] Hide Fujifilm simulations from CMD-K menu when configured --- README.md | 2 +- src/site/CommandK.tsx | 6 ++++-- src/site/SiteChecklistClient.tsx | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ccd31e7d..bbd07dd1 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ Application behavior can be changed by configuring the following environment var - `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 -- `NEXT_PUBLIC_HIDE_FILM_SIMULATIONS = 1` prevents Fujifilm simulations showing up in `/grid` sidebar +- `NEXT_PUBLIC_HIDE_FILM_SIMULATIONS = 1` prevents Fujifilm simulations showing up in `/grid` sidebar and CMD-K search results - `NEXT_PUBLIC_HIDE_EXIF_DATA = 1` hides EXIF data in photo details and OG images (potentially useful for portfolios, which don't focus on photography) - `NEXT_PUBLIC_GRID_ASPECT_RATIO = 1.5` sets aspect ratio for grid tiles (defaults to `1`—setting to `0` removes the constraint) - `NEXT_PUBLIC_OG_TEXT_ALIGNMENT = BOTTOM` keeps OG image text bottom aligned (default is top) diff --git a/src/site/CommandK.tsx b/src/site/CommandK.tsx index e62f87c8..fd4f13f9 100644 --- a/src/site/CommandK.tsx +++ b/src/site/CommandK.tsx @@ -15,7 +15,7 @@ import { formatCount, formatCountDescriptive } from '@/utility/string'; import { TagsWithMeta } from '@/tag'; import PhotoFilmSimulationIcon from '@/simulation/PhotoFilmSimulationIcon'; import { IoMdCamera } from 'react-icons/io'; -import { ADMIN_DEBUG_TOOLS_ENABLED } from './config'; +import { ADMIN_DEBUG_TOOLS_ENABLED, SHOW_FILM_SIMULATIONS } from './config'; export default async function CommandK() { const [ @@ -27,7 +27,9 @@ export default async function CommandK() { getPhotosCountCached().catch(() => 0), getUniqueTagsCached().catch(() => [] as TagsWithMeta), getUniqueCamerasCached().catch(() => []), - getUniqueFilmSimulationsCached().catch(() => []), + SHOW_FILM_SIMULATIONS + ? getUniqueFilmSimulationsCached().catch(() => []) + : [], ]); const SECTION_CAMERAS: CommandKSection = { diff --git a/src/site/SiteChecklistClient.tsx b/src/site/SiteChecklistClient.tsx index 46f3c641..ebf884a2 100644 --- a/src/site/SiteChecklistClient.tsx +++ b/src/site/SiteChecklistClient.tsx @@ -445,7 +445,8 @@ export default function SiteChecklistClient({ optional > Set environment variable to {'"1"'} to prevent - simulations showing up in /grid sidebar: + simulations showing up in /grid sidebar and + CMD-K search results: {renderEnvVars(['NEXT_PUBLIC_HIDE_FILM_SIMULATIONS'])}