fix: recipe version diff readability + i18n, tooltip on markdown export

- Version compare used positional (index-by-index) list alignment —
  inserting one ingredient in the middle shifted every subsequent line
  out of alignment, making the whole rest of the list look changed.
  Switch to diffArrays (LCS-based) so insertions/deletions are
  detected properly; adjacent removed+added chunks still get paired
  for word-level diffing so a single edited item doesn't render as a
  full delete+insert.
- Translated "Title"/"Description"/"Ingredients"/"Steps" diff section
  headers, "Version History" sheet title, compare/restore buttons,
  loading/empty states, and the version-detail ingredient/step count
  summary (with proper plural forms).
- formatDate() in version history was hardcoded to "en-US" regardless
  of the app's locale — now uses the session locale.
- ExportMarkdownButton had no hover tooltip (bare title attribute) —
  wrap it in the same Tooltip pattern every other icon button in the
  toolbar uses.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-09 04:19:33 +02:00
parent 10233b3ef9
commit 1614da38cd
5 changed files with 125 additions and 54 deletions
@@ -10,6 +10,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
export function ExportMarkdownButton({
markdown,
@@ -43,11 +44,18 @@ export function ExportMarkdownButton({
return (
<DropdownMenu>
<DropdownMenuTrigger render={
<Button variant="ghost" size="icon" title={t("exportMarkdown")}>
<FileDown className="h-4 w-4" />
</Button>
} />
<TooltipProvider>
<Tooltip>
<TooltipTrigger render={
<DropdownMenuTrigger render={
<Button variant="ghost" size="icon">
<FileDown className="h-4 w-4" />
</Button>
} />
} />
<TooltipContent>{t("exportMarkdown")}</TooltipContent>
</Tooltip>
</TooltipProvider>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => { void handleCopy(); }}>
<Copy className="h-4 w-4" />