import type { StepTechStepView } from "@batch-cooking/shared"; import { Fragment } from "react"; import { useTranslation } from "react-i18next"; import { Tooltip } from "../../../components/ui/Tooltip"; import { splitDescriptionByTechSteps } from "./highlight-tech-steps"; /** * A recipe step's description, with every detected technique's exact * matched words highlighted and given a {@link Tooltip} naming the * technique (e.g. hovering/focusing "hacher" in "Hacher les oignons" shows * "Hacher") — `RecipeDetailPanel`'s replacement for a bare `
{description}
`. * * `techStep.key` resolves its tooltip label through `catalog.techSteps.
{segments.map((segment, index) => {
// A segment's own text/techStep don't uniquely identify it (the
// same word can appear twice in one description) — index is the
// only thing that does, but this list is fully regenerated from
// `description`/`techSteps` on every render (never reordered or
// spliced in place), so using it as part of the key is safe here.
const key = `${index}-${segment.text}`;
if (!segment.techStep) return