import type { TechStepView } from "@batch-cooking/shared"; /** * The display label for a technique — its French catalog label * (`t(\`catalog.techSteps.${key}\`)`) for a real seeded technique, or the * user's verbatim text for a **placeholder** (`isPlaceholder`, the free text * a user typed while correcting a step when the catalog was missing the * technique — issue #130, `TechStep.isPlaceholder` in schema.prisma), which * has no i18n key at all. Same `displayName ?? t(...)` split as * `ingredients/ingredient-label.ts`; `t` is passed in so this stays a plain * function. */ export function techStepLabel( techStep: Pick, t: (key: string) => string, ): string { return techStep.isPlaceholder && techStep.displayName !== null ? techStep.displayName : t(`catalog.techSteps.${techStep.key}`); }