feat: private accounts, explore/people merge, meal-plan fixes, i18n and theme cleanup

- Private accounts: users.isPrivate hides a user from search and their
  recipes from search/trending/for-you discovery surfaces (follow-aware
  where the route already has session context, blanket exclusion where it
  doesn't); existing followers and direct links are unaffected, no
  follow-request approval flow was built (explicit scope limit)
- Merged /people into the Explore tab (tab=people query param); the old
  standalone route now redirects there
- "Get Ideas" vs "Surprise Me" were doing the same empty-prompt call;
  Surprise Me now injects a real random constraint (5-ingredient, one-pot,
  etc.), matching the existing pattern in the AI recipe-generate dialog
- Meal-plan day cells now link to their recipe (was dead text) and gained
  a one-click "mark as cooked" action
- Theme toggle is now a real three-way light/dark/system control instead
  of a binary flip
- Nutrition goals form had zero i18n wiring; fully localized now

New migration 0027 (users.is_private) generated, left unapplied like the
others. Verified with typecheck, lint, and a clean --no-cache docker build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-10 09:26:03 +02:00
parent 36e7698096
commit 9c545a5bb3
20 changed files with 4804 additions and 82 deletions
@@ -7,6 +7,7 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { useTranslations } from "next-intl";
import { useLocale, SUPPORTED_LOCALES, type Locale } from "@/lib/i18n/provider";
@@ -17,6 +18,7 @@ type UserProps = {
locale: string;
bio: string | null;
privateBio: string | null;
isPrivate: boolean;
};
export function SettingsForm({ user }: { user: UserProps }) {
@@ -29,6 +31,8 @@ export function SettingsForm({ user }: { user: UserProps }) {
const [privateBio, setPrivateBio] = useState(user.privateBio ?? "");
const [saving, setSaving] = useState(false);
const [savingBio, setSavingBio] = useState(false);
const [isPrivate, setIsPrivate] = useState(user.isPrivate);
const [savingPrivacy, setSavingPrivacy] = useState(false);
async function saveProfile() {
setSaving(true);
@@ -65,6 +69,29 @@ export function SettingsForm({ user }: { user: UserProps }) {
const bioUnchanged = bio === (user.bio ?? "") && privateBio === (user.privateBio ?? "");
async function savePrivacy(checked: boolean) {
setSavingPrivacy(true);
const previous = isPrivate;
setIsPrivate(checked);
try {
const res = await fetch("/api/v1/users/me", {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ isPrivate: checked }),
});
if (res.ok) toast.success(t_common("saved"));
else {
setIsPrivate(previous);
toast.error(t_common("saveFailed"));
}
} catch {
setIsPrivate(previous);
toast.error(t_common("saveFailed"));
} finally {
setSavingPrivacy(false);
}
}
return (
<div className="space-y-6">
<section className="rounded-xl border p-6 space-y-4">
@@ -115,6 +142,23 @@ export function SettingsForm({ user }: { user: UserProps }) {
</Button>
</section>
<section className="rounded-xl border p-6 space-y-1">
<div className="flex items-center justify-between">
<div>
<h2 className="font-semibold text-lg">{t("privateAccount")}</h2>
<p className="text-sm text-muted-foreground mt-1 max-w-prose">
{t("privateAccountDescription")}
</p>
</div>
<Switch
id="private-account"
checked={isPrivate}
disabled={savingPrivacy}
onCheckedChange={(checked) => { void savePrivacy(checked); }}
/>
</div>
</section>
<section className="rounded-xl border p-6 space-y-4">
<h2 className="font-semibold text-lg">{t("language")}</h2>
<p className="text-sm text-muted-foreground">{t("languageDescription")}</p>