From 0319b796ae9ce5cfbef5a9348ccf6e9d4cea30d5 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 24 Jul 2026 12:58:04 +0200 Subject: [PATCH] fix: hide recipe variations button when locked instead of disabled+lock-badge (v0.78.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was the one gated feature still shown as a clickable disabled button with a small lock icon overlay, opening an upgrade dialog on click. Every other gated feature (pairings, nutrition estimate, markdown export) hides entirely instead — brought this one in line and removed the now-dead locked/UpgradeDialog code from VariationsButton. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 5 +++ FEATURE_AUDIT.md | 1 + apps/web/app/(app)/recipes/[id]/page.tsx | 41 ++++++++++--------- .../components/admin/feature-flags-form.tsx | 2 +- .../components/recipe/variations-button.tsx | 21 +--------- apps/web/lib/changelog.ts | 9 +++- apps/web/package.json | 2 +- package.json | 2 +- 8 files changed, 40 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56943d4..8483dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ 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.78.1 — 2026-07-24 14:10 + +### Fixed +- Recipe variations button was the one leftover spot still shown disabled with a small lock badge for tiers without the feature, instead of hidden entirely like every other gated feature. Now hidden, matching meal/drink pairings, nutrition estimation, and Markdown export. + ## 0.78.0 — 2026-07-24 13:40 ### Fixed diff --git a/FEATURE_AUDIT.md b/FEATURE_AUDIT.md index 6cbfcc6..b22c5a8 100644 --- a/FEATURE_AUDIT.md +++ b/FEATURE_AUDIT.md @@ -116,6 +116,7 @@ Status legend: **Exists** (fully working) · **Partial** (works but with a real | Stripe webhook (checkout/cancel) | Exists | Signature-verified, replay-protected, event-deduped — production quality | `apps/web/app/api/webhooks/stripe/route.ts` | | Stripe checkout + self-serve billing portal (2026-07-23) | Exists | `POST /api/v1/billing/checkout` creates a subscription Checkout Session (promotion codes enabled); `POST /api/v1/billing/portal` opens Stripe's hosted Customer Portal for self-serve cancel/upgrade/card-update. Webhook route rewritten with the real `stripe` SDK (`stripe.webhooks.constructEvent`, replacing the hand-rolled HMAC verifier) and now handles the full event set: `checkout.session.completed`, `customer.subscription.{updated,deleted}`, `invoice.{payment_failed,paid}` — `past_due` deliberately doesn't downgrade tier (Stripe retries the card first). `/settings/billing` shows plan cards, usage, and a "Manage billing" button; `/admin/billing` shows connection status, subscriber counts, past-due list, recent billing audit events. Cancel/downgrade is at period end (Stripe Portal default); no trial period. **Not yet built:** family-group multi-user sharing (Family tier is purchasable solo, but the plan's per-account member invite/join/tier-resolution piece is deliberately deferred — see `plans/STRIPE_PLAN.md` §1a, flagged there as the most novel/error-prone piece, intentionally shipped after solo billing is proven). | `apps/web/lib/stripe.ts`, `apps/web/app/api/webhooks/stripe/route.ts`, `apps/web/app/api/v1/billing/**`, `apps/web/app/(app)/settings/billing/page.tsx`, `apps/web/app/admin/billing/page.tsx` | | Admin dashboard | Exists | 15 sections (was 13, missing Billing until this pass): overview, insights/analytics, users, invites, recipe moderation, reports, support, tier limits, **billing**, webhooks, audit logs, storage, AI config, site settings, changelog | `apps/web/app/admin/layout.tsx` (`adminNav`) | +| Variations button lock-badge (closed 2026-07-24) | Exists | Was the one gated feature still shown disabled with a small lock-icon overlay + upgrade-dialog-on-click instead of hidden entirely; now hidden like every other gated feature, and the dead locked/`UpgradeDialog` code was removed from `VariationsButton`. | `apps/web/components/recipe/variations-button.tsx`, `apps/web/app/(app)/recipes/[id]/page.tsx` | | Feature flags (per-tier) vs feature prefs (per-user cosmetic) | Exists, two distinct systems | Flags now gate 9 capabilities by tier (was 3): recipe_variations/drink_pairing/meal_pairing (default enabled) plus recipe_import_url, recipe_import_photo, nutrition_estimation, markdown_export, weekly_nutrition, grocery_delivery (2026-07-24, default **disabled** for all tiers — admin turns on per tier from `/admin/tiers`). Each key's own `defaultEnabled` governs the fallback when no admin override row exists, not a blanket true. Prefs let users hide 7 nav sections, no billing implication, unrelated system. | `apps/web/lib/{feature-flags,feature-prefs}.ts` | | **Developer permission** (2026-07-22, split 2026-07-23) | Exists | Two separate, orthogonal permissions — not one. `users.isDeveloper` gates webhooks + self-serve API keys: admin-toggled always, *and* self-serve toggleable by the user themselves once on a paid tier (no added fee) via `PATCH /api/v1/users/me/developer-access`; free-tier users still need an admin grant. `users.isByokEnabled` gates BYOK separately, admin-only, no self-serve — routing real AI spend through Epicure on the user's own key warrants a manual check-in. Previously all three (webhooks/API keys/BYOK) shared one flag with zero self-serve path. Existing users with a webhook/API key were already grandfathered for `isDeveloper`; a second migration grandfathered existing BYOK users into `isByokEnabled` specifically. | `apps/web/lib/permissions.ts` (`hasDeveloperAccess`, `hasByokAccess`, `canSelfServeDeveloperAccess`), `apps/web/lib/api-auth.ts` (`requireDeveloper`, `requireByok`) | | User webhooks (personal automation) | Exists | 7 events, Zapier-style, requires developer access | `apps/web/lib/webhooks.ts` | diff --git a/apps/web/app/(app)/recipes/[id]/page.tsx b/apps/web/app/(app)/recipes/[id]/page.tsx index fdafe05..836b4c1 100644 --- a/apps/web/app/(app)/recipes/[id]/page.tsx +++ b/apps/web/app/(app)/recipes/[id]/page.tsx @@ -232,26 +232,27 @@ export default async function RecipePage({ params }: Params) { ingredients={recipe.ingredients.map((ing) => ({ rawName: ing.rawName }))} /> )} - ({ - rawName: ing.rawName, - quantity: ing.quantity, - unit: ing.unit, - note: ing.note, - order: ing.order, - }))} - steps={recipe.steps.map((s) => ({ - instruction: s.instruction, - timerSeconds: s.timerSeconds, - order: s.order, - }))} - locked={locked.variations} - /> + {!locked.variations && ( + ({ + rawName: ing.rawName, + quantity: ing.quantity, + unit: ing.unit, + note: ing.note, + order: ing.order, + }))} + steps={recipe.steps.map((s) => ({ + instruction: s.instruction, + timerSeconds: s.timerSeconds, + order: s.order, + }))} + /> + )} diff --git a/apps/web/components/admin/feature-flags-form.tsx b/apps/web/components/admin/feature-flags-form.tsx index 22c7d56..49adf68 100644 --- a/apps/web/components/admin/feature-flags-form.tsx +++ b/apps/web/components/admin/feature-flags-form.tsx @@ -48,7 +48,7 @@ export function FeatureFlagsForm({

Feature Toggles

- Disable a feature for a tier to hide it for that tier's users (most features hide entirely; a few show a locked/upgrade state instead — see each feature's actual behavior in the app). + Disable a feature for a tier to hide it entirely for that tier's users.

diff --git a/apps/web/components/recipe/variations-button.tsx b/apps/web/components/recipe/variations-button.tsx index 84cf656..02a9c4c 100644 --- a/apps/web/components/recipe/variations-button.tsx +++ b/apps/web/components/recipe/variations-button.tsx @@ -2,11 +2,10 @@ import { useState } from "react"; import { useTranslations } from "next-intl"; -import { GitBranch, Lock } from "lucide-react"; +import { GitBranch } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { VariationsDialog } from "./variations-dialog"; -import { UpgradeDialog } from "@/components/premium/upgrade-dialog"; export function VariationsButton({ recipeId, @@ -16,7 +15,6 @@ export function VariationsButton({ cookMins, ingredients, steps, - locked = false, }: { recipeId: string; baseServings: number; @@ -25,26 +23,17 @@ export function VariationsButton({ cookMins?: number | null; ingredients: Array<{ rawName: string; quantity?: string | number | null; unit?: string | null; note?: string | null; order: number }>; steps: Array<{ instruction: string; timerSeconds?: number | null; order: number }>; - locked?: boolean; }) { const t = useTranslations("recipe"); const [open, setOpen] = useState(false); - const [upgradeOpen, setUpgradeOpen] = useState(false); return ( <> (locked ? setUpgradeOpen(true) : setOpen(true))} - aria-label={t("variationsTooltip")} - className="relative" - > + } /> {t("variationsTooltip")} @@ -61,12 +50,6 @@ export function VariationsButton({ open={open} onOpenChange={setOpen} /> - ); } diff --git a/apps/web/lib/changelog.ts b/apps/web/lib/changelog.ts index d0e57a6..76c1a32 100644 --- a/apps/web/lib/changelog.ts +++ b/apps/web/lib/changelog.ts @@ -1,5 +1,5 @@ // Mirrors CHANGELOG.md at the repo root — update both together. -export const APP_VERSION = "0.78.0"; +export const APP_VERSION = "0.78.1"; export type ChangelogEntry = { version: string; @@ -11,6 +11,13 @@ export type ChangelogEntry = { }; export const CHANGELOG: ChangelogEntry[] = [ + { + version: "0.78.1", + date: "2026-07-24 14:10", + fixed: [ + "Recipe variations button was the one leftover spot still shown disabled with a small lock badge for tiers without the feature, instead of hidden entirely like every other gated feature. Now hidden, matching meal/drink pairings, nutrition estimation, and Markdown export.", + ], + }, { version: "0.78.0", date: "2026-07-24 13:40", diff --git a/apps/web/package.json b/apps/web/package.json index df27476..704fce3 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@epicure/web", - "version": "0.78.0", + "version": "0.78.1", "private": true, "scripts": { "dev": "next dev", diff --git a/package.json b/package.json index 1f5bfef..dd22a3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "epicure", - "version": "0.78.0", + "version": "0.78.1", "private": true, "scripts": { "dev": "pnpm --filter web dev",