feat: push+email notifications, recipe notes, fork/clone, pantry-aware lists, GDPR export

Five S-sized items from HANDOFF.md's new-features backlog, all wiring up
previously-orphaned infra:

- createNotification now sends web push + email for every notification type
  (follow/comment/reply/reaction/rating/mention), not just comments
- Personal recipe notes: private per-user notes on any viewable recipe
  (recipeNotes table had zero API/UI before this)
- Recipe fork/clone: deep-copies a viewable recipe into your own library as
  a private draft, linked via recipeVariations, respects tier quota
- Pantry-aware shopping lists: meal-plan-generated lists now subtract
  on-hand pantry quantities (ingredientId match, falling back to normalized
  name match) and flag partial/ambiguous matches instead of guessing
- GDPR data export: downloadable JSON of a user's own content and activity
  across every relevant table, secrets/internal tables excluded

New migrations 0025 (unique index for recipe-notes upsert) and 0026
(shopping_list_items.in_pantry) generated, left unapplied like 0023/0024.
Verified with typecheck, lint, and a full local `docker build`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-10 07:50:58 +02:00
parent d035378520
commit 45b886e398
23 changed files with 9813 additions and 23 deletions
@@ -0,0 +1,68 @@
"use client";
import { useState } from "react";
import { useTranslations } from "next-intl";
import { Lock } from "lucide-react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
export function RecipeNotes({
recipeId,
initialContent,
}: {
recipeId: string;
initialContent: string;
}) {
const t = useTranslations("recipeNotes");
const [content, setContent] = useState(initialContent);
const [savedContent, setSavedContent] = useState(initialContent);
const [saving, setSaving] = useState(false);
const dirty = content !== savedContent;
async function save() {
setSaving(true);
try {
const res = await fetch(`/api/v1/recipes/${recipeId}/notes`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content }),
});
if (!res.ok) {
toast.error(t("saveFailed"));
return;
}
const data = (await res.json()) as { note: { content: string } | null };
const newContent = data.note?.content ?? "";
setContent(newContent);
setSavedContent(newContent);
toast.success(t("saved"));
} finally {
setSaving(false);
}
}
return (
<div className="rounded-lg border border-dashed p-4 space-y-3">
<div className="flex items-center gap-2 text-sm font-medium">
<Lock className="h-4 w-4 text-muted-foreground" />
{t("title")}
</div>
<p className="text-xs text-muted-foreground">{t("visibilityHint")}</p>
<Textarea
value={content}
onChange={(e) => setContent(e.target.value)}
onBlur={() => dirty && !saving && save()}
placeholder={t("placeholder")}
maxLength={5000}
rows={3}
/>
<div className="flex justify-end">
<Button type="button" size="sm" variant="outline" disabled={!dirty || saving} onClick={save}>
{saving ? t("saving") : t("save")}
</Button>
</div>
</div>
);
}