Restore hovers in recipe overlay

This commit is contained in:
Sam Becker 2025-09-07 18:00:52 -05:00
parent b56c852e58
commit de0fa04ef8
3 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,6 @@
import { createCameraKey, Camera } from '@/camera'; import { createCameraKey, Camera } from '@/camera';
import { createLensKey, Lens } from '@/lens'; import { createLensKey, Lens } from '@/lens';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { FujifilmSimulation } from '@/platforms/fujifilm/simulation';
import { useAppState } from '@/app/AppState'; import { useAppState } from '@/app/AppState';
export default function useCategoryCounts() { export default function useCategoryCounts() {
@ -27,7 +26,7 @@ export default function useCategoryCounts() {
return recipeCounts[recipe]; return recipeCounts[recipe];
}, [categoriesWithCounts]); }, [categoriesWithCounts]);
const getFilmCount = useCallback((film: FujifilmSimulation) => { const getFilmCount = useCallback((film: string) => {
const filmCounts = categoriesWithCounts?.films ?? {}; const filmCounts = categoriesWithCounts?.films ?? {};
return filmCounts[film]; return filmCounts[film];
}, [categoriesWithCounts]); }, [categoriesWithCounts]);

View File

@ -19,7 +19,6 @@ import camelcaseKeys from 'camelcase-keys';
import { isBefore } from 'date-fns'; import { isBefore } from 'date-fns';
import type { Metadata } from 'next'; import type { Metadata } from 'next';
import { FujifilmRecipe } from '@/platforms/fujifilm/recipe'; import { FujifilmRecipe } from '@/platforms/fujifilm/recipe';
import { FujifilmSimulation } from '@/platforms/fujifilm/simulation';
import { PhotoUpdateStatus, generatePhotoUpdateStatus } from './update'; import { PhotoUpdateStatus, generatePhotoUpdateStatus } from './update';
import { AppTextState } from '@/i18n/state'; import { AppTextState } from '@/i18n/state';
import { PhotoColorData } from './color/client'; import { PhotoColorData } from './color/client';
@ -64,7 +63,7 @@ export interface PhotoExif {
exposureCompensation?: number exposureCompensation?: number
latitude?: number latitude?: number
longitude?: number longitude?: number
film?: FujifilmSimulation film?: string
recipeData?: string recipeData?: string
takenAt?: string takenAt?: string
takenAtNaive?: string takenAtNaive?: string

View File

@ -19,6 +19,7 @@ import { TbChecklist } from 'react-icons/tb';
import CopyButton from '@/components/CopyButton'; import CopyButton from '@/components/CopyButton';
import PhotoRecipe from './PhotoRecipe'; import PhotoRecipe from './PhotoRecipe';
import { useAppText } from '@/i18n/state/client'; import { useAppText } from '@/i18n/state/client';
import useCategoryCounts from '@/category/useCategoryCounts';
export default function PhotoRecipeOverlay({ export default function PhotoRecipeOverlay({
ref, ref,
@ -48,6 +49,11 @@ export default function PhotoRecipeOverlay({
const appText = useAppText(); const appText = useAppText();
const {
getRecipeCount,
getFilmCount,
} = useCategoryCounts();
const whiteBalanceTypeFormatted = formatWhiteBalance(data); const whiteBalanceTypeFormatted = formatWhiteBalance(data);
const renderDataSquare = ( const renderDataSquare = (
@ -128,6 +134,7 @@ export default function PhotoRecipeOverlay({
'[&>*>*>*>*]:text-black', '[&>*>*>*>*]:text-black',
'tracking-wide', 'tracking-wide',
)} )}
countOnHover={getRecipeCount(title)}
/> />
: renderRecipeTitle} : renderRecipeTitle}
</div> </div>
@ -170,6 +177,7 @@ export default function PhotoRecipeOverlay({
'opacity-80 hover:opacity-60 active:opacity-80', 'opacity-80 hover:opacity-60 active:opacity-80',
)} )}
badged={false} badged={false}
countOnHover={getFilmCount(film)}
/> />
</div>, </div>,
undefined, undefined,