Skip to content

Commit 3bcf995

Browse files
committed
Conditionally shows new prompt button based on subscription level.
1 parent 7e9e5a4 commit 3bcf995

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

apps/web/app/components/Navigation.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,12 @@ export default function Navigation({ hasDashboardAccess }: { hasDashboardAccess?
1919
<nav className="border-ps" style={{ borderBottomWidth: '1px' }}>
2020
<div className="container mx-auto p-4 md:px-6 md:py-4">
2121
<div className="flex gap-4 flex-col md:items-center">
22-
{/* Logo */}
2322
<Link
2423
href="/"
2524
className="text-lg md:text-2xl font-bold text-ps-primary hover:opacity-80 transition-opacity"
2625
>
2726
Postscript
2827
</Link>
29-
30-
{/* Navigation Links */}
3128
<div className="flex gap-2 justify-start md:items-center md:gap-6">
3229
{navItems.map((item) => {
3330
const isActive = pathname === item.href;

apps/web/app/prompt/page.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Link from 'next/link';
33
import { requireAuth } from '../actions/auth';
44
import { fetchUserPrompts } from '../actions/prompt';
55
import GenerateNewPrompt from '../components/GenerateNewPrompt';
6+
import { fetchUserSubscription } from '../actions/account';
67

78
type Prompt = {
89
id: string;
@@ -17,6 +18,8 @@ export default async function Prompt() {
1718
redirect('/');
1819
}
1920
const prompts = await fetchUserPrompts(userId);
21+
const subscription = await fetchUserSubscription();
22+
const hasGeneratePromptAccess = subscription?.planType === 'PLATINUM';
2023

2124
return (
2225
<div className="min-h-screen bg-ps-primary">
@@ -31,7 +34,9 @@ export default async function Prompt() {
3134
You may still respond to any open prompts. Click on any prompt to
3235
view details or write your entry.
3336
</p>
34-
<GenerateNewPrompt />
37+
{hasGeneratePromptAccess && (
38+
<GenerateNewPrompt />
39+
)}
3540
</div>
3641
<div className="flex flex-col gap-2 space-y-4">
3742
{prompts?.length > 0 ? (

0 commit comments

Comments
 (0)