diff --git a/README.md b/README.md index d327c6ec..6b7f8798 100644 --- a/README.md +++ b/README.md @@ -128,12 +128,7 @@ Application behavior can be changed by configuring the following environment var - `NEXT_PUBLIC_IMAGE_QUALITY = 1-100` controls the quality of large photos - `NEXT_PUBLIC_BLUR_DISABLED = 1` prevents image blur data being stored and displayed (potentially useful for limiting Postgres usage) -#### Visual - -- `NEXT_PUBLIC_DEFAULT_THEME = light | dark` sets preferred initial theme (defaults to `system` when not configured) -- `NEXT_PUBLIC_MATTE_PHOTOS = 1` constrains the size of each photo, and displays a surrounding border, potentially useful for photos with tall aspect ratios (colors can be customized via `NEXT_PUBLIC_MATTE_COLOR` + `NEXT_PUBLIC_MATTE_COLOR_DARK`) - -#### Display +#### Categories - `NEXT_PUBLIC_CATEGORY_VISIBILITY` - Comma-separated value controlling which photo sets appear in grid sidebar and CMD-K menu, and in what order. For example, you could move cameras above tags, and hide film simulations, by updating to `cameras,tags,lenses,recipes`. - Accepted values: @@ -144,6 +139,9 @@ Application behavior can be changed by configuring the following environment var - `films` (default) - `focal-lengths` - `NEXT_PUBLIC_EXHAUSTIVE_SIDEBAR_CATEGORIES = 1` always shows expanded sidebar content +- `NEXT_PUBLIC_HIDE_TAGS_WITH_ONE_PHOTO = 1` to only show tags with 2 or more photos + +#### Display - `NEXT_PUBLIC_HIDE_KEYBOARD_SHORTCUT_TOOLTIPS = 1` hides keyboard shortcut hints in areas like the main nav, and previous/next photo links - `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_CATEGORY_IMAGE_HOVERS = 1` shows images when hovering over category links like cameras and lenses (⚠️ setting `NEXT_PUBLIC_STATICALLY_OPTIMIZE_PHOTO_CATEGORY_OG_IMAGES = 1` strongly recommended for responsive hover interactions) @@ -157,6 +155,10 @@ Application behavior can be changed by configuring the following environment var - `NEXT_PUBLIC_GRID_ASPECT_RATIO = 1.5` sets aspect ratio for grid tiles (defaults to `1`—setting to `0` removes the constraint) - `NEXT_PUBLIC_SHOW_LARGE_THUMBNAILS = 1` ensures large thumbnails on photo grid views (if not configured, density is based on aspect ratio) +#### Design +- `NEXT_PUBLIC_DEFAULT_THEME = light | dark` sets preferred initial theme (defaults to `system` when not configured) +- `NEXT_PUBLIC_MATTE_PHOTOS = 1` constrains the size of each photo, and displays a surrounding border, potentially useful for photos with tall aspect ratios (colors can be customized via `NEXT_PUBLIC_MATTE_COLOR` + `NEXT_PUBLIC_MATTE_COLOR_DARK`) + #### Settings - `NEXT_PUBLIC_GEO_PRIVACY = 1` disables collection/display of location-based data (⚠️ re-compresses uploaded images in order to remove GPS information) - `NEXT_PUBLIC_ALLOW_PUBLIC_DOWNLOADS = 1` enables public photo downloads for all visitors (⚠️ may result in increased bandwidth usage) diff --git a/src/admin/AdminAppConfigurationClient.tsx b/src/admin/AdminAppConfigurationClient.tsx index ef939837..009b4539 100644 --- a/src/admin/AdminAppConfigurationClient.tsx +++ b/src/admin/AdminAppConfigurationClient.tsx @@ -80,10 +80,12 @@ export default function AdminAppConfigurationClient({ hasImageQuality, imageQuality, isBlurEnabled, - // Display + // Categories categoryVisibility, hasCategoryVisibility, collapseSidebarCategories, + hideTagsWithOnePhoto, + // Display showKeyboardShortcutTooltips, showExifInfo, showCategoryImageHover, @@ -401,7 +403,7 @@ export default function AdminAppConfigurationClient({ } + icon={} optional > } + icon={} optional > + + Set environment variable to {'"1"'} to only show tags + with 2 or more photos + {renderEnvVars(['NEXT_PUBLIC_HIDE_TAGS_WITH_ONE_PHOTO'])} + HIDE_TAGS_WITH_ONE_PHOTO + ? { + ..._categories, + tags: limitTagsByCount(_categories.tags, 2), + } + : _categories + , [_categories]); + const { cameras, lenses, diff --git a/src/tag/index.ts b/src/tag/index.ts index 05a6b592..a2ac1fe5 100644 --- a/src/tag/index.ts +++ b/src/tag/index.ts @@ -167,3 +167,10 @@ export const convertTagsForForm = ( annotationAria: formatCountDescriptive(count, appText.category.taggedPhotos), })); + +export const limitTagsByCount = (tags: Tags, minimumCount: number) => + tags.filter(({ tag, count }) => ( + count >= minimumCount || + isTagFavs(tag) || + isTagHidden(tag) + ));