Some checks failed
Calque le pattern « ingrédient hors-catalogue » sur `TechStep` : cinq colonnes additives (`isPlaceholder`/`displayName`/`createdById`/`createdAt`/ `reviewedAt`), migration purement additive, FK `createdById → user_profiles` en `SET NULL`. Correction d'étape : `submitTechStepCorrectionSchema` accepte `correctedTechStepName` (mutuellement exclusif de `correctedTechStepId`) ; `submitTechStepCorrection` crée une `TechStep` placeholder dans la transaction et poursuit comme si son id avait été fourni. La correction s'applique immédiatement (`source: manual`) ; nouvel event analytics `tech_step.placeholder_proposed`. `TechStepView` gagne `isPlaceholder`/`displayName` ; `GET /reference/tech-steps` exclut les placeholders. Nouveau helper web `techStepLabel` (`displayName ?? t(catalog.techSteps.<key>)`), utilisé par `StepDescription` et le popover. Le popover a une échappatoire « Ma technique n'est pas dans la liste » (champ libre). Admin : `admin-tech-step-catalog.service.ts` + routes `GET/PATCH /admin/api/catalog/tech-step-placeholders` (liste plate — les propositions de technique sont rares) ; `CatalogPage` gagne un sélecteur Ingrédients / Techniques. Tests : Mocha (proposition placeholder, rejet id+nom, exclusion catalogue, liste + mark-reviewed admin) + Cypress (composant popover, e2e admin catalogue). Assertions `.techStep` existantes mises à jour pour les 2 nouveaux champs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
20 lines
880 B
TypeScript
20 lines
880 B
TypeScript
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<TechStepView, "key" | "isPlaceholder" | "displayName">,
|
|
t: (key: string) => string,
|
|
): string {
|
|
return techStep.isPlaceholder && techStep.displayName !== null
|
|
? techStep.displayName
|
|
: t(`catalog.techSteps.${techStep.key}`);
|
|
}
|