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:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -18,6 +19,7 @@ interface NutritionGoalsFormProps {
|
||||
}
|
||||
|
||||
export function NutritionGoalsForm({ initialGoals }: NutritionGoalsFormProps) {
|
||||
const t = useTranslations("settings.nutritionGoals");
|
||||
const [caloriesKcal, setCaloriesKcal] = useState<string>(
|
||||
initialGoals?.caloriesKcal != null ? String(initialGoals.caloriesKcal) : ""
|
||||
);
|
||||
@@ -50,13 +52,13 @@ export function NutritionGoalsForm({ initialGoals }: NutritionGoalsFormProps) {
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
toast.error("Failed to save nutrition goals");
|
||||
toast.error(t("saveError"));
|
||||
return;
|
||||
}
|
||||
|
||||
toast.success("Nutrition goals saved");
|
||||
toast.success(t("saveSuccess"));
|
||||
} catch {
|
||||
toast.error("Failed to save nutrition goals");
|
||||
toast.error(t("saveError"));
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
@@ -66,52 +68,52 @@ export function NutritionGoalsForm({ initialGoals }: NutritionGoalsFormProps) {
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="caloriesKcal">Calories (kcal/day)</Label>
|
||||
<Label htmlFor="caloriesKcal">{t("caloriesLabel")}</Label>
|
||||
<Input
|
||||
id="caloriesKcal"
|
||||
type="number"
|
||||
min={0}
|
||||
value={caloriesKcal}
|
||||
onChange={(e) => setCaloriesKcal(e.target.value)}
|
||||
placeholder="e.g. 2000"
|
||||
placeholder={t("caloriesPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="proteinG">Protein (g/day)</Label>
|
||||
<Label htmlFor="proteinG">{t("proteinLabel")}</Label>
|
||||
<Input
|
||||
id="proteinG"
|
||||
type="number"
|
||||
min={0}
|
||||
value={proteinG}
|
||||
onChange={(e) => setProteinG(e.target.value)}
|
||||
placeholder="e.g. 50"
|
||||
placeholder={t("proteinPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="carbsG">Carbs (g/day)</Label>
|
||||
<Label htmlFor="carbsG">{t("carbsLabel")}</Label>
|
||||
<Input
|
||||
id="carbsG"
|
||||
type="number"
|
||||
min={0}
|
||||
value={carbsG}
|
||||
onChange={(e) => setCarbsG(e.target.value)}
|
||||
placeholder="e.g. 250"
|
||||
placeholder={t("carbsPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="fatG">Fat (g/day)</Label>
|
||||
<Label htmlFor="fatG">{t("fatLabel")}</Label>
|
||||
<Input
|
||||
id="fatG"
|
||||
type="number"
|
||||
min={0}
|
||||
value={fatG}
|
||||
onChange={(e) => setFatG(e.target.value)}
|
||||
placeholder="e.g. 70"
|
||||
placeholder={t("fatPlaceholder")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Button type="submit" disabled={saving}>
|
||||
{saving ? "Saving..." : "Save goals"}
|
||||
{saving ? t("saving") : t("saveButton")}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user