Files
Epicure/apps/web/app/(app)/recipes/new/page.tsx
T
Arnaud 1dd8abfd52 fix: standardize locked-vs-hidden treatment across all 9 per-tier gated features (v0.79.0)
Rule, applied consistently everywhere via a new isFeatureAvailableAnyTier() helper: if a feature is enabled on at least one tier, it stays visible for locked-out viewers with a small "Pro" badge and opens an upgrade prompt on click; if a feature is disabled on every tier, it hides entirely, since there's no upgrade path to point at.

Covers: recipe variations, meal/drink pairings, nutrition estimation, Markdown export (5 call sites), weekly nutrition, import from URL, import from photo, and the Instacart grocery-delivery menu item. Previously inconsistent — some hid outright, one showed a lock icon overlapping its own icon.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 13:33:04 +02:00

28 lines
1.2 KiB
TypeScript

import type { Metadata } from "next";
import { headers } from "next/headers";
import { auth } from "@/lib/auth/server";
import { RecipeForm } from "@/components/recipe/recipe-form";
import { NewRecipeHeader } from "@/components/recipe/new-recipe-header";
import { PhotoImportButton } from "@/components/recipe/photo-import-button";
import { getFeatureFlagMatrix, isFeatureAvailableAnyTier, type Tier } from "@/lib/feature-flags";
export const metadata: Metadata = {};
export default async function NewRecipePage() {
const session = await auth.api.getSession({ headers: await headers() });
const viewerTier = (session?.user as { tier?: string } | undefined)?.tier as Tier | undefined ?? "free";
const featureFlags = await getFeatureFlagMatrix();
const importPhotoLocked = !featureFlags.recipe_import_photo[viewerTier];
const importPhotoAvailable = isFeatureAvailableAnyTier(featureFlags, "recipe_import_photo");
return (
<div className="space-y-6">
<div className="flex items-start justify-between gap-4">
<NewRecipeHeader />
{importPhotoAvailable && <PhotoImportButton locked={importPhotoLocked} />}
</div>
<RecipeForm />
</div>
);
}