"use client"; import { diffWords } from "diff"; export type DiffSnapshot = { title: string; description?: string | null; ingredients: Array<{ rawName: string; quantity?: string | number | null; unit?: string | null; note?: string | null }>; steps: Array<{ instruction: string; timerSeconds?: number | null }>; }; function ingredientLine(i: DiffSnapshot["ingredients"][number]): string { return [i.quantity, i.unit, i.rawName, i.note && `(${i.note})`].filter(Boolean).join(" "); } function stepLine(s: DiffSnapshot["steps"][number]): string { return s.instruction; } function TextDiff({ before, after }: { before: string; after: string }) { const parts = diffWords(before, after); return (
{parts.map((part, i) => ( {part.value} ))}
); } function ListDiff({ before, after }: { before: string[]; after: string[] }) { const max = Math.max(before.length, after.length); const rows = []; for (let i = 0; i < max; i++) { const b = before[i]; const a = after[i]; if (b === undefined) { rows.push(