From a494a230b559364079e9b25a7946ca86b51b0efb Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Fri, 14 Mar 2025 00:22:28 -0500 Subject: [PATCH] Refine recipe text export --- src/recipe/PhotoRecipeOverlay.tsx | 2 +- src/recipe/index.ts | 49 ++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/recipe/PhotoRecipeOverlay.tsx b/src/recipe/PhotoRecipeOverlay.tsx index b94ddc5c..f0d92ec6 100644 --- a/src/recipe/PhotoRecipeOverlay.tsx +++ b/src/recipe/PhotoRecipeOverlay.tsx @@ -121,7 +121,7 @@ export default function PhotoRecipeOverlay({ label={`${title ? `${formatRecipe(title).toLocaleUpperCase()} recipe` : 'Recipe'}`} - text={generateRecipeText({ recipe, simulation }).join('\n')} + text={generateRecipeText({ title, recipe, simulation }).join('\n')} iconSize={17} className={clsx( 'translate-y-[-0.5px]', diff --git a/src/recipe/index.ts b/src/recipe/index.ts index c6551bb7..dc0fff5a 100644 --- a/src/recipe/index.ts +++ b/src/recipe/index.ts @@ -55,6 +55,7 @@ export const descriptionForRecipePhotos = ( ); export const generateRecipeText = ({ + title, recipe, simulation, }: RecipeProps, @@ -64,30 +65,58 @@ abbreviate?: boolean, `${labelForFilmSimulation(simulation).small.toLocaleUpperCase()}`, // eslint-disable-next-line max-len `${formatWhiteBalance(recipe).toLocaleUpperCase()} ${formatWhiteBalanceColor(recipe)}`, - `DR${recipe.dynamicRange.development} NR${formatNoiseReduction(recipe)}`, ]; - if (recipe.highlight || recipe.shadow) { + if (abbreviate) { // eslint-disable-next-line max-len - lines.push(`HIGH${addSign(recipe.highlight)} SHADOW${addSign(recipe.shadow)}`); + lines.push(`DR${recipe.dynamicRange.development} NR${formatNoiseReduction(recipe)}`); + } else { + lines.push( + `DYNAMIC RANGE ${recipe.dynamicRange.development}`, + `NOISE REDUCTION ${formatNoiseReduction(recipe)}`, + ); } - // eslint-disable-next-line max-len - lines.push(`COL${addSign(recipe.color)} SHARP${addSign(recipe.sharpness)} CLAR${addSign(recipe.clarity)}`); + + if (recipe.highlight || recipe.shadow) { + lines.push(abbreviate + ? `HIGH${addSign(recipe.highlight)} SHAD${addSign(recipe.shadow)}` + // eslint-disable-next-line max-len + : `HIGHLIGHT ${addSign(recipe.highlight)} SHADOW ${addSign(recipe.shadow)}`, + ); + } + lines.push(abbreviate + // eslint-disable-next-line max-len + ? `COL${addSign(recipe.color)} SHARP${addSign(recipe.sharpness)} CLAR${addSign(recipe.clarity)}` + // eslint-disable-next-line max-len + : `COLOR ${addSign(recipe.color)} SHARPEN ${addSign(recipe.sharpness)} CLARITY ${addSign(recipe.clarity)}`, + ); if (recipe.colorChromeEffect) { - lines.push(`CHROME ${recipe.colorChromeEffect.toLocaleUpperCase()}`); + lines.push(abbreviate + ? `CHROME ${recipe.colorChromeEffect.toLocaleUpperCase()}` + : `COLOR CHROME ${recipe.colorChromeEffect.toLocaleUpperCase()}`, + ); } if (recipe.colorChromeFXBlue) { - lines.push(`FX BLUE ${recipe.colorChromeFXBlue.toLocaleUpperCase()}`); + lines.push(abbreviate + ? `FX BLUE ${recipe.colorChromeFXBlue.toLocaleUpperCase()}` + : `CHROME FX BLUE ${recipe.colorChromeFXBlue.toLocaleUpperCase()}`, + ); } if (recipe.grainEffect.roughness !== 'off') { lines.push(`GRAIN ${formatGrain(recipe, abbreviate)}`); } if (recipe.bwAdjustment || recipe.bwMagentaGreen) { - // eslint-disable-next-line max-len - lines.push(`BW ADJ ${addSign(recipe.bwAdjustment)} BW M/G ${addSign(recipe.bwMagentaGreen)}`); + lines.push(abbreviate + // eslint-disable-next-line max-len + ? `BW ADJ${addSign(recipe.bwAdjustment)} M/G${addSign(recipe.bwMagentaGreen)}` + // eslint-disable-next-line max-len + : `BW ADJUSTMENT ${addSign(recipe.bwAdjustment)} MAGENTA/GREEN ${addSign(recipe.bwMagentaGreen)}`, + ); } - return lines; + return title + ? [formatRecipe(title).toLocaleUpperCase(),'–', ...lines] + : lines; }; export const generateMetaForRecipe = (