Offer config for showing only tags with multiple photos
This commit is contained in:
parent
c73c36951d
commit
21d465c1ec
14
README.md
14
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)
|
||||
|
||||
@ -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({
|
||||
<ChecklistGroup
|
||||
title="AI text generation"
|
||||
titleShort="AI"
|
||||
icon={<HiSparkles />}
|
||||
icon={<HiSparkles size={14} />}
|
||||
optional
|
||||
>
|
||||
<ChecklistRow
|
||||
@ -470,7 +472,7 @@ export default function AdminAppConfigurationClient({
|
||||
</ChecklistGroup>
|
||||
<ChecklistGroup
|
||||
title="Performance"
|
||||
icon={<RiSpeedMiniLine size={18} />}
|
||||
icon={<RiSpeedMiniLine size={19} />}
|
||||
optional
|
||||
>
|
||||
<ChecklistRow
|
||||
@ -578,6 +580,15 @@ export default function AdminAppConfigurationClient({
|
||||
expanded category content
|
||||
{renderEnvVars(['NEXT_PUBLIC_EXHAUSTIVE_SIDEBAR_CATEGORIES'])}
|
||||
</ChecklistRow>
|
||||
<ChecklistRow
|
||||
title="Hide tags with only 1 photo"
|
||||
status={hideTagsWithOnePhoto}
|
||||
optional
|
||||
>
|
||||
Set environment variable to {'"1"'} to only show tags
|
||||
with 2 or more photos
|
||||
{renderEnvVars(['NEXT_PUBLIC_HIDE_TAGS_WITH_ONE_PHOTO'])}
|
||||
</ChecklistRow>
|
||||
</ChecklistGroup>
|
||||
<ChecklistGroup
|
||||
title="Display"
|
||||
|
||||
@ -240,7 +240,7 @@ export const IMAGE_QUALITY =
|
||||
export const BLUR_ENABLED =
|
||||
process.env.NEXT_PUBLIC_BLUR_DISABLED !== '1';
|
||||
|
||||
// DISPLAY
|
||||
// CATEGORIES
|
||||
|
||||
export const CATEGORY_VISIBILITY = getOrderedCategoriesFromString(
|
||||
process.env.NEXT_PUBLIC_CATEGORY_VISIBILITY);
|
||||
@ -258,6 +258,11 @@ export const SHOW_FOCAL_LENGTHS =
|
||||
CATEGORY_VISIBILITY.includes('focal-lengths');
|
||||
export const COLLAPSE_SIDEBAR_CATEGORIES =
|
||||
process.env.NEXT_PUBLIC_EXHAUSTIVE_SIDEBAR_CATEGORIES !== '1';
|
||||
export const HIDE_TAGS_WITH_ONE_PHOTO =
|
||||
process.env.NEXT_PUBLIC_HIDE_TAGS_WITH_ONE_PHOTO === '1';
|
||||
|
||||
// DISPLAY
|
||||
|
||||
export const SHOW_KEYBOARD_SHORTCUT_TOOLTIPS =
|
||||
process.env.NEXT_PUBLIC_HIDE_KEYBOARD_SHORTCUT_TOOLTIPS !== '1';
|
||||
export const SHOW_EXIF_DATA =
|
||||
@ -388,11 +393,13 @@ export const APP_CONFIGURATION = {
|
||||
hasImageQuality: Boolean(process.env.NEXT_PUBLIC_IMAGE_QUALITY),
|
||||
imageQuality: IMAGE_QUALITY,
|
||||
isBlurEnabled: BLUR_ENABLED,
|
||||
// Display
|
||||
// Categories
|
||||
hasCategoryVisibility:
|
||||
Boolean(process.env.NEXT_PUBLIC_CATEGORY_VISIBILITY),
|
||||
categoryVisibility: CATEGORY_VISIBILITY,
|
||||
collapseSidebarCategories: COLLAPSE_SIDEBAR_CATEGORIES,
|
||||
hideTagsWithOnePhoto: HIDE_TAGS_WITH_ONE_PHOTO,
|
||||
// Display
|
||||
showKeyboardShortcutTooltips: SHOW_KEYBOARD_SHORTCUT_TOOLTIPS,
|
||||
showExifInfo: SHOW_EXIF_DATA,
|
||||
showCategoryImageHover: SHOW_CATEGORY_IMAGE_HOVERS,
|
||||
|
||||
@ -4,13 +4,13 @@ import PhotoCamera from '@/camera/PhotoCamera';
|
||||
import HeaderList from '@/components/HeaderList';
|
||||
import PhotoTag from '@/tag/PhotoTag';
|
||||
import { PhotoDateRange, dateRangeForPhotos, photoQuantityText } from '.';
|
||||
import { TAG_FAVS, TAG_HIDDEN, addHiddenToTags } from '@/tag';
|
||||
import { TAG_FAVS, TAG_HIDDEN, addHiddenToTags, limitTagsByCount } from '@/tag';
|
||||
import PhotoFilm from '@/film/PhotoFilm';
|
||||
import FavsTag from '../tag/FavsTag';
|
||||
import { useAppState } from '@/state/AppState';
|
||||
import { useMemo, useRef } from 'react';
|
||||
import HiddenTag from '@/tag/HiddenTag';
|
||||
import { CATEGORY_VISIBILITY } from '@/app/config';
|
||||
import { CATEGORY_VISIBILITY, HIDE_TAGS_WITH_ONE_PHOTO } from '@/app/config';
|
||||
import { clsx } from 'clsx/lite';
|
||||
import PhotoRecipe from '@/recipe/PhotoRecipe';
|
||||
import IconCamera from '@/components/icons/IconCamera';
|
||||
@ -37,7 +37,7 @@ export default function PhotoGridSidebar({
|
||||
containerHeight,
|
||||
aboutTextSafelyParsedHtml,
|
||||
aboutTextHasBrParagraphBreaks,
|
||||
...categories
|
||||
..._categories
|
||||
}: PhotoSetCategories & {
|
||||
photosCount: number
|
||||
photosDateRange?: PhotoDateRange
|
||||
@ -45,6 +45,14 @@ export default function PhotoGridSidebar({
|
||||
aboutTextSafelyParsedHtml?: string
|
||||
aboutTextHasBrParagraphBreaks?: boolean
|
||||
}) {
|
||||
const categories = useMemo(() => HIDE_TAGS_WITH_ONE_PHOTO
|
||||
? {
|
||||
..._categories,
|
||||
tags: limitTagsByCount(_categories.tags, 2),
|
||||
}
|
||||
: _categories
|
||||
, [_categories]);
|
||||
|
||||
const {
|
||||
cameras,
|
||||
lenses,
|
||||
|
||||
@ -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)
|
||||
));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user