Upgrade photo stats with lenses

This commit is contained in:
Sam Becker 2025-03-16 22:25:20 -05:00
parent c3b3fe4367
commit 2f055ae743
3 changed files with 53 additions and 38 deletions

View File

@ -3,6 +3,7 @@ import {
getUniqueCameras, getUniqueCameras,
getUniqueFilmSimulations, getUniqueFilmSimulations,
getUniqueFocalLengths, getUniqueFocalLengths,
getUniqueLenses,
getUniqueRecipes, getUniqueRecipes,
getUniqueTags, getUniqueTags,
} from '@/photo/db/query'; } from '@/photo/db/query';
@ -26,23 +27,25 @@ export default async function AdminAppInsights() {
{ count: photosCountHidden }, { count: photosCountHidden },
photosCountOutdated, photosCountOutdated,
{ count: photosCountPortrait }, { count: photosCountPortrait },
tags, codeMeta,
cameras, cameras,
lenses,
tags,
recipes, recipes,
filmSimulations, filmSimulations,
focalLengths, focalLengths,
codeMeta,
] = await Promise.all([ ] = await Promise.all([
getPhotosMeta({ hidden: 'include' }), getPhotosMeta({ hidden: 'include' }),
getPhotosMeta({ hidden: 'only' }), getPhotosMeta({ hidden: 'only' }),
getOutdatedPhotosCount(), getOutdatedPhotosCount(),
getPhotosMeta({ maximumAspectRatio: 0.9 }), getPhotosMeta({ maximumAspectRatio: 0.9 }),
getUniqueTags(), getGitHubMetaForCurrentApp(),
getUniqueCameras(), getUniqueCameras(),
getUniqueLenses(),
getUniqueTags(),
getUniqueRecipes(), getUniqueRecipes(),
getUniqueFilmSimulations(), getUniqueFilmSimulations(),
getUniqueFocalLengths(), getUniqueFocalLengths(),
getGitHubMetaForCurrentApp(),
]); ]);
const { isAiTextGenerationEnabled } = APP_CONFIGURATION; const { isAiTextGenerationEnabled } = APP_CONFIGURATION;
@ -82,8 +85,9 @@ export default async function AdminAppInsights() {
photosCount, photosCount,
photosCountHidden, photosCountHidden,
photosCountOutdated, photosCountOutdated,
tagsCount: tags.length,
camerasCount: cameras.length, camerasCount: cameras.length,
lensesCount: lenses.length,
tagsCount: tags.length,
recipesCount: recipes.length, recipesCount: recipes.length,
filmSimulationsCount: filmSimulations.length, filmSimulationsCount: filmSimulations.length,
focalLengthsCount: focalLengths.length, focalLengthsCount: focalLengths.length,

View File

@ -3,15 +3,11 @@
import ScoreCard from '@/components/ScoreCard'; import ScoreCard from '@/components/ScoreCard';
import ScoreCardRow from '@/components/ScoreCardRow'; import ScoreCardRow from '@/components/ScoreCardRow';
import { dateRangeForPhotos } from '@/photo'; import { dateRangeForPhotos } from '@/photo';
import PhotoFilmSimulationIcon from '@/simulation/PhotoFilmSimulationIcon';
import { FaCamera } from 'react-icons/fa';
import { FaTag } from 'react-icons/fa';
import { FaCircleInfo, FaRegCalendar } from 'react-icons/fa6'; import { FaCircleInfo, FaRegCalendar } from 'react-icons/fa6';
import { HiMiniArrowsUpDown } from 'react-icons/hi2'; import { HiMiniArrowsUpDown } from 'react-icons/hi2';
import { HiOutlinePhotograph } from 'react-icons/hi';
import { MdAspectRatio } from 'react-icons/md'; import { MdAspectRatio } from 'react-icons/md';
import { PiWarningBold } from 'react-icons/pi'; import { PiWarningBold } from 'react-icons/pi';
import { TbChecklist, TbCone, TbSparkles } from 'react-icons/tb'; import { TbSparkles } from 'react-icons/tb';
import { BiGitBranch, BiGitCommit, BiLogoGithub } from 'react-icons/bi'; import { BiGitBranch, BiGitCommit, BiLogoGithub } from 'react-icons/bi';
import { import {
TEMPLATE_REPO_BRANCH, TEMPLATE_REPO_BRANCH,
@ -42,6 +38,13 @@ import { pluralize } from '@/utility/string';
import Tooltip from '@/components/Tooltip'; import Tooltip from '@/components/Tooltip';
import { useAppState } from '@/state/AppState'; import { useAppState } from '@/state/AppState';
import ScoreCardContainer from '@/components/ScoreCardContainer'; import ScoreCardContainer from '@/components/ScoreCardContainer';
import IconLens from '@/components/icons/IconLens';
import IconCamera from '@/components/icons/IconCamera';
import IconRecipe from '@/components/icons/IconRecipe';
import IconFilmSimulation from '@/components/icons/IconFilmSimulation';
import IconFocalLength from '@/components/icons/IconFocalLength';
import IconTag from '@/components/icons/IconTag';
import IconPhoto from '@/components/icons/IconPhoto';
const DEBUG_COMMIT_SHA = '4cd29ed'; const DEBUG_COMMIT_SHA = '4cd29ed';
const DEBUG_COMMIT_MESSAGE = 'Long commit message for debugging purposes'; const DEBUG_COMMIT_MESSAGE = 'Long commit message for debugging purposes';
@ -88,8 +91,9 @@ export default function AdminAppInsightsClient({
photosCount, photosCount,
photosCountHidden, photosCountHidden,
photosCountOutdated, photosCountOutdated,
tagsCount,
camerasCount, camerasCount,
lensesCount,
tagsCount,
recipesCount, recipesCount,
filmSimulationsCount, filmSimulationsCount,
focalLengthsCount, focalLengthsCount,
@ -405,8 +409,8 @@ export default function AdminAppInsightsClient({
expandPath={PATH_ADMIN_OUTDATED} expandPath={PATH_ADMIN_OUTDATED}
/>} />}
<ScoreCardRow <ScoreCardRow
icon={<HiOutlinePhotograph icon={<IconPhoto
size={17} size={15}
className="translate-y-[0.5px]" className="translate-y-[0.5px]"
/>} />}
content={<> content={<>
@ -416,29 +420,38 @@ export default function AdminAppInsightsClient({
/> />
{CATEGORY_VISIBILITY.map(category => { {CATEGORY_VISIBILITY.map(category => {
switch (category) { switch (category) {
case 'tags':
return <ScoreCardRow
key={category}
icon={<FaTag
size={12}
className="translate-y-[3px]"
/>}
content={pluralize(tagsCount, 'tag')}
/>;
case 'cameras': case 'cameras':
return <ScoreCardRow return <ScoreCardRow
key={category} key={category}
icon={<FaCamera icon={<IconCamera
size={13} size={15}
className="translate-y-[2px]" className="translate-y-[0.5px]"
/>} />}
content={pluralize(camerasCount, 'camera')} content={pluralize(camerasCount, 'camera')}
/>; />;
case 'lenses':
return <ScoreCardRow
key={category}
icon={<IconLens
size={15}
className="translate-y-[0.5px]"
/>}
content={pluralize(lensesCount, 'lens', 'lenses')}
/>;
case 'tags':
return <ScoreCardRow
key={category}
icon={<IconTag
size={15}
className="translate-x-[1px] translate-y-[1px]"
/>}
content={pluralize(tagsCount, 'tag')}
/>;
case 'recipes': case 'recipes':
return recipesCount > 0 return recipesCount > 0
? <ScoreCardRow ? <ScoreCardRow
key={category} key={category}
icon={<TbChecklist icon={<IconRecipe
size={18} size={18}
className="translate-y-[-0.5px]" className="translate-y-[-0.5px]"
/>} />}
@ -449,25 +462,22 @@ export default function AdminAppInsightsClient({
return filmSimulationsCount > 0 return filmSimulationsCount > 0
? <ScoreCardRow ? <ScoreCardRow
key={category} key={category}
icon={<span className="inline-flex w-3"> icon={<IconFilmSimulation size={15} />}
<PhotoFilmSimulationIcon
className="shrink-0 translate-x-[-2px] translate-y-[-0.5px]"
height={18}
/>
</span>}
content={pluralize(filmSimulationsCount, 'film simulation')} content={pluralize(filmSimulationsCount, 'film simulation')}
/> />
: null; : null;
case 'focal-lengths':
return <ScoreCardRow
key={category}
icon={<IconFocalLength size={14} />}
content={pluralize(focalLengthsCount, 'focal length')}
/>;
} }
})} })}
<ScoreCardRow
icon={<TbCone className="rotate-[270deg] translate-x-[-2px]" />}
content={pluralize(focalLengthsCount, 'focal length')}
/>
{descriptionWithSpaces && <ScoreCardRow {descriptionWithSpaces && <ScoreCardRow
icon={<FaRegCalendar icon={<FaRegCalendar
size={13} size={13}
className="translate-y-[1.5px] translate-x-[-2px]" className="translate-y-[1.5px]"
/>} />}
content={descriptionWithSpaces} content={descriptionWithSpaces}
/>} />}

View File

@ -48,8 +48,9 @@ export interface PhotoStats {
photosCount: number photosCount: number
photosCountHidden: number photosCountHidden: number
photosCountOutdated: number photosCountOutdated: number
tagsCount: number
camerasCount: number camerasCount: number
lensesCount: number
tagsCount: number
recipesCount: number recipesCount: number
filmSimulationsCount: number filmSimulationsCount: number
focalLengthsCount: number focalLengthsCount: number