'use client'; import LoaderButton from '@/components/primitives/LoaderButton'; import { FujifilmRecipe } from '@/platforms/fujifilm/recipe'; import { FilmSimulation } from '@/simulation'; import PhotoFilmSimulation from '@/simulation/PhotoFilmSimulation'; import clsx from 'clsx/lite'; import { ReactNode, RefObject } from 'react'; import { IoCloseCircle } from 'react-icons/io5'; import { motion } from 'framer-motion'; const addSign = (value = 0) => value < 0 ? value : `+${value}`; export default function PhotoRecipe({ ref, recipe: { dynamicRange, whiteBalance, highISONoiseReduction, noiseReductionBasic, highlight, shadow, color, sharpness, clarity, colorChromeEffect, colorChromeFXBlue, grainEffect, bwAdjustment, bwMagentaGreen, }, simulation, iso, exposure, onClose, }: { ref?: RefObject recipe: FujifilmRecipe simulation: FilmSimulation iso?: string exposure?: string onClose?: () => void }) { const whiteBalanceTypeFormatted = whiteBalance.type .replace(/auto./i, '') .replaceAll('-', ' '); const renderRow = (children: ReactNode) =>
{children}
; const renderDataSquare = ( value: ReactNode, label?: string, className?: string, ) => (
{typeof value === 'number' ? addSign(value) : value}
{label &&
{label}
}
); return (
} onClick={onClose} className={clsx( 'link p-0 m-0 h-4!', 'text-black/40 active:text-black/75', )} />
{renderRow(<> {renderDataSquare(`DR${dynamicRange.development}`)} {renderDataSquare(iso)} {renderDataSquare(exposure ?? '0ev')} )} {renderRow(<> {renderDataSquare( whiteBalanceTypeFormatted.toUpperCase(), `R${addSign(whiteBalance?.red)} / B${addSign(whiteBalance?.blue)}`, 'basis-2/3', )} {renderDataSquare( highISONoiseReduction ?? noiseReductionBasic ?? 'OFF', 'ISO NR', 'basis-1/3', )} )} {renderRow(<> {renderDataSquare(highlight, 'Highlight')} {renderDataSquare(shadow, 'Shadow')} )} {renderRow(<> {renderDataSquare(color, 'Color')} {renderDataSquare(sharpness, 'Sharpness')} {renderDataSquare(clarity, 'Clarity')} )} {renderRow(<> {renderDataSquare( colorChromeEffect?.toLocaleUpperCase() ?? 'N/A', 'Color Chrome', )} {renderDataSquare( colorChromeFXBlue?.toLocaleUpperCase() ?? 'N/A', 'FX Blue', )} )} {renderRow(<> {renderDataSquare( grainEffect.roughness.toLocaleUpperCase(), grainEffect.size === 'large' ? 'Large Grain' : grainEffect.size === 'small' ? 'Small Grain' : 'Grain', )} {renderDataSquare(bwAdjustment ?? 0, 'BW ADJ')} {renderDataSquare(bwMagentaGreen ?? 0, 'BW M/G')} )}
); }