fix: desktop nav ignored feature toggles; add chatbots toggle (v0.62.0)
Feature toggles (Settings -> Features) were filtered into visibleNavItems but the desktop horizontal nav still mapped over the raw NAV_ITEMS list, so hiding a feature only worked on mobile. Both nav renders now read the same filtered list. Also adds a Chatbots toggle covering the recipe cooking-chat panel and the recipe-list cooking assistant, wired end-to-end (schema, migration, feature-prefs lib, API route, settings form, i18n, openapi). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
All notable changes to Epicure are documented here. This file is mirrored in-app at `/changelog` (and in the admin dashboard) via `apps/web/lib/changelog.ts` — update both together.
|
All notable changes to Epicure are documented here. This file is mirrored in-app at `/changelog` (and in the admin dashboard) via `apps/web/lib/changelog.ts` — update both together.
|
||||||
|
|
||||||
|
## 0.62.0 — 2026-07-20 23:45
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Settings → Features: new Chatbots toggle — hides both the recipe cooking-chat panel and the recipe-list cooking assistant when off.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Feature toggles (Settings → Features) were only respected by the mobile hamburger menu — the desktop horizontal nav still showed every item regardless of your saved preferences. Both now read the same visibility list.
|
||||||
|
|
||||||
## 0.61.0 — 2026-07-20 23:15
|
## 0.61.0 — 2026-07-20 23:15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { CommentsSection } from "@/components/social/comments-section";
|
|||||||
import { getPublicUrl } from "@/lib/storage";
|
import { getPublicUrl } from "@/lib/storage";
|
||||||
import { cn, stripMarkdown } from "@/lib/utils";
|
import { cn, stripMarkdown } from "@/lib/utils";
|
||||||
import { RecipeChatPanel } from "@/components/recipe/recipe-chat-panel";
|
import { RecipeChatPanel } from "@/components/recipe/recipe-chat-panel";
|
||||||
|
import { getFeaturePrefs } from "@/lib/feature-prefs";
|
||||||
import { BatchCookSteps } from "@/components/recipe/batch-cook-steps";
|
import { BatchCookSteps } from "@/components/recipe/batch-cook-steps";
|
||||||
import { BatchCookDishes } from "@/components/recipe/batch-cook-dishes";
|
import { BatchCookDishes } from "@/components/recipe/batch-cook-dishes";
|
||||||
import { KeepScreenAwake } from "@/components/recipe/keep-screen-awake";
|
import { KeepScreenAwake } from "@/components/recipe/keep-screen-awake";
|
||||||
@@ -71,7 +72,7 @@ export default async function RecipePage({ params }: Params) {
|
|||||||
const DIETARY_LABELS = m.recipe.dietary;
|
const DIETARY_LABELS = m.recipe.dietary;
|
||||||
const unitPref = (session.user as { unitPref?: string }).unitPref === "imperial" ? "imperial" : "metric";
|
const unitPref = (session.user as { unitPref?: string }).unitPref === "imperial" ? "imperial" : "metric";
|
||||||
|
|
||||||
const [recipe, ratingData, favoriteData, myRating, forkedFrom, myNote, dishCookLog, featureFlags] = await Promise.all([
|
const [recipe, ratingData, favoriteData, myRating, forkedFrom, myNote, dishCookLog, featureFlags, featurePrefs] = await Promise.all([
|
||||||
db.query.recipes.findFirst({
|
db.query.recipes.findFirst({
|
||||||
where: and(
|
where: and(
|
||||||
eq(recipes.id, id),
|
eq(recipes.id, id),
|
||||||
@@ -102,6 +103,7 @@ export default async function RecipePage({ params }: Params) {
|
|||||||
columns: { batchDishId: true, cookedAt: true },
|
columns: { batchDishId: true, cookedAt: true },
|
||||||
}),
|
}),
|
||||||
getFeatureFlagMatrix(),
|
getFeatureFlagMatrix(),
|
||||||
|
getFeaturePrefs(session.user.id),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!recipe) notFound();
|
if (!recipe) notFound();
|
||||||
@@ -507,7 +509,7 @@ export default async function RecipePage({ params }: Params) {
|
|||||||
<Separator />
|
<Separator />
|
||||||
<RecipeNotes recipeId={id} initialContent={myNote?.content ?? ""} />
|
<RecipeNotes recipeId={id} initialContent={myNote?.content ?? ""} />
|
||||||
|
|
||||||
<RecipeChatPanel recipeId={id} recipeTitle={recipe.title} />
|
{featurePrefs.chatbots && <RecipeChatPanel recipeId={id} recipeTitle={recipe.title} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { RecipesEmptyState } from "@/components/recipe/recipes-empty-state";
|
|||||||
import { RecipesGrid } from "@/components/recipe/recipes-grid";
|
import { RecipesGrid } from "@/components/recipe/recipes-grid";
|
||||||
import { CookingAssistantPanel } from "@/components/recipe/cooking-assistant-panel";
|
import { CookingAssistantPanel } from "@/components/recipe/cooking-assistant-panel";
|
||||||
import { getMessages } from "@/lib/i18n/server";
|
import { getMessages } from "@/lib/i18n/server";
|
||||||
|
import { getFeaturePrefs } from "@/lib/feature-prefs";
|
||||||
|
|
||||||
export const metadata: Metadata = {};
|
export const metadata: Metadata = {};
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ export default async function RecipesPage({ searchParams }: { searchParams: Sear
|
|||||||
const session = await auth.api.getSession({ headers: await headers() });
|
const session = await auth.api.getSession({ headers: await headers() });
|
||||||
if (!session) return null;
|
if (!session) return null;
|
||||||
const m = getMessages((session.user as { locale?: string }).locale);
|
const m = getMessages((session.user as { locale?: string }).locale);
|
||||||
|
const featurePrefs = await getFeaturePrefs(session.user.id);
|
||||||
|
|
||||||
const { q, sort, visibility, difficulty, tag, page: pageParam, batchCook, recipeType } = await searchParams;
|
const { q, sort, visibility, difficulty, tag, page: pageParam, batchCook, recipeType } = await searchParams;
|
||||||
const query = (q ?? "").trim().slice(0, 200);
|
const query = (q ?? "").trim().slice(0, 200);
|
||||||
@@ -160,7 +162,7 @@ export default async function RecipesPage({ searchParams }: { searchParams: Sear
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<CookingAssistantPanel />
|
{featurePrefs.chatbots && <CookingAssistantPanel />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const PutSchema = z.object({
|
|||||||
shoppingLists: z.boolean().optional(),
|
shoppingLists: z.boolean().optional(),
|
||||||
collections: z.boolean().optional(),
|
collections: z.boolean().optional(),
|
||||||
messages: z.boolean().optional(),
|
messages: z.boolean().optional(),
|
||||||
|
chatbots: z.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export function Nav() {
|
|||||||
// backend default — avoids a flash of items disappearing on load for the
|
// backend default — avoids a flash of items disappearing on load for the
|
||||||
// (much more common) case where a user hasn't hidden anything.
|
// (much more common) case where a user hasn't hidden anything.
|
||||||
const [featurePrefs, setFeaturePrefs] = useState<FeaturePrefs>({
|
const [featurePrefs, setFeaturePrefs] = useState<FeaturePrefs>({
|
||||||
nutrition: true, pantry: true, mealPlan: true, shoppingLists: true, collections: true, messages: true,
|
nutrition: true, pantry: true, mealPlan: true, shoppingLists: true, collections: true, messages: true, chatbots: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -121,7 +121,7 @@ export function Nav() {
|
|||||||
<span>Epicure</span>
|
<span>Epicure</span>
|
||||||
</Link>
|
</Link>
|
||||||
<nav className="hidden md:flex items-center gap-1">
|
<nav className="hidden md:flex items-center gap-1">
|
||||||
{NAV_ITEMS.map(({ href, key, icon: Icon }) => (
|
{visibleNavItems.map(({ href, key, icon: Icon }) => (
|
||||||
<Link
|
<Link
|
||||||
key={href}
|
key={href}
|
||||||
href={href}
|
href={href}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Switch } from "@/components/ui/switch";
|
|||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import type { FeatureKey, FeaturePrefs } from "@/lib/feature-prefs";
|
import type { FeatureKey, FeaturePrefs } from "@/lib/feature-prefs";
|
||||||
|
|
||||||
const FEATURES: FeatureKey[] = ["nutrition", "pantry", "mealPlan", "shoppingLists", "collections", "messages"];
|
const FEATURES: FeatureKey[] = ["nutrition", "pantry", "mealPlan", "shoppingLists", "collections", "messages", "chatbots"];
|
||||||
|
|
||||||
export function FeatureTogglesForm() {
|
export function FeatureTogglesForm() {
|
||||||
const t = useTranslations("settingsForm.featureToggles");
|
const t = useTranslations("settingsForm.featureToggles");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Mirrors CHANGELOG.md at the repo root — update both together.
|
// Mirrors CHANGELOG.md at the repo root — update both together.
|
||||||
export const APP_VERSION = "0.61.0";
|
export const APP_VERSION = "0.62.0";
|
||||||
|
|
||||||
export type ChangelogEntry = {
|
export type ChangelogEntry = {
|
||||||
version: string;
|
version: string;
|
||||||
@@ -11,6 +11,16 @@ export type ChangelogEntry = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CHANGELOG: ChangelogEntry[] = [
|
export const CHANGELOG: ChangelogEntry[] = [
|
||||||
|
{
|
||||||
|
version: "0.62.0",
|
||||||
|
date: "2026-07-20 23:45",
|
||||||
|
added: [
|
||||||
|
"Settings → Features: new Chatbots toggle — hides both the recipe cooking-chat panel and the recipe-list cooking assistant when off.",
|
||||||
|
],
|
||||||
|
fixed: [
|
||||||
|
"Feature toggles (Settings → Features) were only respected by the mobile hamburger menu — the desktop horizontal nav still showed every item regardless of your saved preferences. Both now read the same visibility list.",
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
version: "0.61.0",
|
version: "0.61.0",
|
||||||
date: "2026-07-20 23:15",
|
date: "2026-07-20 23:15",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { db, userFeaturePrefs, eq } from "@epicure/db";
|
import { db, userFeaturePrefs, eq } from "@epicure/db";
|
||||||
|
|
||||||
export type FeatureKey = "nutrition" | "pantry" | "mealPlan" | "shoppingLists" | "collections" | "messages";
|
export type FeatureKey = "nutrition" | "pantry" | "mealPlan" | "shoppingLists" | "collections" | "messages" | "chatbots";
|
||||||
|
|
||||||
export type FeaturePrefs = Record<FeatureKey, boolean>;
|
export type FeaturePrefs = Record<FeatureKey, boolean>;
|
||||||
|
|
||||||
const DEFAULT_PREFS: FeaturePrefs = {
|
const DEFAULT_PREFS: FeaturePrefs = {
|
||||||
nutrition: true, pantry: true, mealPlan: true, shoppingLists: true, collections: true, messages: true,
|
nutrition: true, pantry: true, mealPlan: true, shoppingLists: true, collections: true, messages: true, chatbots: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** No row yet means every feature defaults to on — same default the DB columns encode. */
|
/** No row yet means every feature defaults to on — same default the DB columns encode. */
|
||||||
@@ -15,5 +15,6 @@ export async function getFeaturePrefs(userId: string): Promise<FeaturePrefs> {
|
|||||||
return {
|
return {
|
||||||
nutrition: row.nutrition, pantry: row.pantry, mealPlan: row.mealPlan,
|
nutrition: row.nutrition, pantry: row.pantry, mealPlan: row.mealPlan,
|
||||||
shoppingLists: row.shoppingLists, collections: row.collections, messages: row.messages,
|
shoppingLists: row.shoppingLists, collections: row.collections, messages: row.messages,
|
||||||
|
chatbots: row.chatbots,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -478,11 +478,12 @@ export function generateOpenApiSpec(): object {
|
|||||||
}));
|
}));
|
||||||
const FeaturePrefsRef = registry.register("FeaturePrefs", z.object({
|
const FeaturePrefsRef = registry.register("FeaturePrefs", z.object({
|
||||||
nutrition: z.boolean(), pantry: z.boolean(), mealPlan: z.boolean(),
|
nutrition: z.boolean(), pantry: z.boolean(), mealPlan: z.boolean(),
|
||||||
shoppingLists: z.boolean(), collections: z.boolean(), messages: z.boolean(),
|
shoppingLists: z.boolean(), collections: z.boolean(), messages: z.boolean(), chatbots: z.boolean(),
|
||||||
}).describe("Purely cosmetic — hides the feature from the user's own nav. Never restricts access to the underlying pages/routes."));
|
}).describe("Purely cosmetic — hides the feature from the user's own nav. Never restricts access to the underlying pages/routes."));
|
||||||
const UpdateFeaturePrefsRef = registry.register("UpdateFeaturePrefs", z.object({
|
const UpdateFeaturePrefsRef = registry.register("UpdateFeaturePrefs", z.object({
|
||||||
nutrition: z.boolean().optional(), pantry: z.boolean().optional(), mealPlan: z.boolean().optional(),
|
nutrition: z.boolean().optional(), pantry: z.boolean().optional(), mealPlan: z.boolean().optional(),
|
||||||
shoppingLists: z.boolean().optional(), collections: z.boolean().optional(), messages: z.boolean().optional(),
|
shoppingLists: z.boolean().optional(), collections: z.boolean().optional(), messages: z.boolean().optional(),
|
||||||
|
chatbots: z.boolean().optional(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const NutritionGoalsRef2 = registry.register("NutritionGoalsMe", z.object({
|
const NutritionGoalsRef2 = registry.register("NutritionGoalsMe", z.object({
|
||||||
|
|||||||
@@ -1428,7 +1428,9 @@
|
|||||||
"collections": "Collections",
|
"collections": "Collections",
|
||||||
"collectionsDescription": "Organize recipes into collections.",
|
"collectionsDescription": "Organize recipes into collections.",
|
||||||
"messages": "Messages",
|
"messages": "Messages",
|
||||||
"messagesDescription": "Direct messages with other cooks."
|
"messagesDescription": "Direct messages with other cooks.",
|
||||||
|
"chatbots": "Chatbots",
|
||||||
|
"chatbotsDescription": "AI cooking assistant and recipe chat."
|
||||||
},
|
},
|
||||||
"profile": "Profile",
|
"profile": "Profile",
|
||||||
"changePhoto": "Change photo",
|
"changePhoto": "Change photo",
|
||||||
|
|||||||
@@ -1419,7 +1419,9 @@
|
|||||||
"collections": "Collections",
|
"collections": "Collections",
|
||||||
"collectionsDescription": "Organisez vos recettes en collections.",
|
"collectionsDescription": "Organisez vos recettes en collections.",
|
||||||
"messages": "Messages",
|
"messages": "Messages",
|
||||||
"messagesDescription": "Messages directs avec d'autres cuisiniers."
|
"messagesDescription": "Messages directs avec d'autres cuisiniers.",
|
||||||
|
"chatbots": "Chatbots",
|
||||||
|
"chatbotsDescription": "Assistant de cuisine et chat sur les recettes."
|
||||||
},
|
},
|
||||||
"profile": "Profil",
|
"profile": "Profil",
|
||||||
"changePhoto": "Changer la photo",
|
"changePhoto": "Changer la photo",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@epicure/web",
|
"name": "@epicure/web",
|
||||||
"version": "0.61.0",
|
"version": "0.62.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "epicure",
|
"name": "epicure",
|
||||||
"version": "0.61.0",
|
"version": "0.62.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm --filter web dev",
|
"dev": "pnpm --filter web dev",
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "user_feature_prefs" ADD COLUMN "chatbots" boolean DEFAULT true NOT NULL;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -400,6 +400,13 @@
|
|||||||
"when": 1784581139361,
|
"when": 1784581139361,
|
||||||
"tag": "0056_shallow_brother_voodoo",
|
"tag": "0056_shallow_brother_voodoo",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 57,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1784582403171,
|
||||||
|
"tag": "0057_sudden_kree",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -208,6 +208,7 @@ export const userFeaturePrefs = pgTable("user_feature_prefs", {
|
|||||||
shoppingLists: boolean("shopping_lists").notNull().default(true),
|
shoppingLists: boolean("shopping_lists").notNull().default(true),
|
||||||
collections: boolean("collections").notNull().default(true),
|
collections: boolean("collections").notNull().default(true),
|
||||||
messages: boolean("messages").notNull().default(true),
|
messages: boolean("messages").notNull().default(true),
|
||||||
|
chatbots: boolean("chatbots").notNull().default(true),
|
||||||
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user