import type { Photo } from '../photo'; import ImageCaption from './components/ImageCaption'; import ImagePhotoGrid from './components/ImagePhotoGrid'; import ImageContainer from './components/ImageContainer'; import type { NextImageSize } from '@/platforms/next-image'; import { formatTag } from '@/tag'; import { TbChecklist } from 'react-icons/tb'; import { generateRecipeText, getPhotoWithRecipeFromPhotos } from '@/recipe'; import PhotoFilmSimulationIcon from '@/simulation/PhotoFilmSimulationIcon'; import { isStringFilmSimulation } from '@/platforms/fujifilm/simulation'; const MAX_RECIPE_LINES = 8; export default function RecipeImageResponse({ recipe, photos, width, height, fontFamily, smallText = true, }: { recipe: string, photos: Photo[] width: NextImageSize height: number fontFamily: string smallText?: boolean }) { const { recipeData, filmSimulation, } = getPhotoWithRecipeFromPhotos(photos) ?? {}; let recipeLines = recipeData && filmSimulation ? generateRecipeText({ recipe: recipeData, simulation: filmSimulation, }, true) : []; if (recipeLines && recipeLines.length > MAX_RECIPE_LINES) { recipeLines = recipeLines.slice(0, MAX_RECIPE_LINES); recipeLines[MAX_RECIPE_LINES - 1] = '•••'; } return (
, title: formatTag(recipe).toLocaleUpperCase(), }}> {recipeData &&
{recipeLines.map(text => (
{text} {isStringFilmSimulation(text) && filmSimulation &&
}
))}
} ); }