From 433e796c041e8d65068084d5c7729c397956098e Mon Sep 17 00:00:00 2001 From: Dries Augustyns Date: Tue, 9 Dec 2025 08:45:53 +0100 Subject: [PATCH] fix: Hide upsell banner if billing is not configured --- apps/web/src/pages/index.tsx | 184 ++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 87 deletions(-) diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx index 2d0c875..f4f96c8 100644 --- a/apps/web/src/pages/index.tsx +++ b/apps/web/src/pages/index.tsx @@ -7,7 +7,7 @@ import { CardContent, CardDescription, CardHeader, - CardTitle, + CardTitle } from '@plunk/ui'; import {AlertCircle, Mail, Send, TrendingUp, Users} from 'lucide-react'; import {NextSeo} from 'next-seo'; @@ -18,11 +18,13 @@ import {QuickStart} from '../components/QuickStart'; import {useActiveProject} from '../lib/contexts/ActiveProjectProvider'; import {useDashboardStats} from '../lib/hooks/useDashboardStats'; import {useProjectSetupState} from '../lib/hooks/useProjectSetupState'; +import {useConfig} from '../lib/hooks/useConfig'; export default function Index() { const {activeProject} = useActiveProject(); const {totalContacts, totalEmailsSent, totalCampaigns, openRate, isLoading} = useDashboardStats(); const {setupState, isLoading: isLoadingSetupState} = useProjectSetupState(activeProject?.id); + const {data: config} = useConfig(); const stats = [ { @@ -52,95 +54,103 @@ export default function Index() {
- {/* Project Disabled Banner */} - {activeProject && activeProject.disabled && ( - - - Project Disabled - Read-Only Mode - - This project has been disabled due to security violations (high bounce or complaint rates). All scheduled - campaigns and workflows have been cancelled. The project is now in read-only mode - you can view your data - but cannot create, update, or delete anything. Please contact support to resolve this issue. - - - )} + {/* Project Disabled Banner */} + {activeProject && activeProject.disabled && ( + + + Project Disabled - Read-Only Mode + + This project has been disabled due to security violations (high bounce or complaint rates). All + scheduled campaigns and workflows have been cancelled. The project is now in read-only mode - you can + view your data but cannot create, update, or delete anything. Please contact support to resolve this + issue. + + + )} - {/* Subscription Warning Banner */} - {activeProject && !activeProject.disabled && !activeProject.subscription && ( - - - Upgrade to remove Plunk branding - - Your emails currently include Plunk branding. Upgrade to a subscription to remove it. - - - - - - )} + {/* Subscription Warning Banner */} + {activeProject && + !activeProject.disabled && + !activeProject.subscription && + config?.features.billing.enabled && ( + + + Upgrade to remove Plunk branding + + + Your emails currently include Plunk branding. Upgrade to a subscription to remove it. + + + + + + + )} - {/* Header */} -
-

Dashboard

-

- Welcome back to {activeProject?.name || 'Plunk'}. Here's what's happening with your emails. -

+ {/* Header */} +
+

Dashboard

+

+ Welcome back to {activeProject?.name || 'Plunk'}. Here's what's happening with your emails. +

+
+ + {/* Stats Grid */} +
+ {stats.map(stat => { + const Icon = stat.icon; + return ( + + +
+ {stat.name} + +
+ {stat.value} +
+
+ ); + })} +
+ + {/* Quick Actions & API Keys */} +
+ {/* Quick Start */} + + + {/* API Keys */} + + + API Keys + Use these keys to integrate with Plunk + + +
+ {activeProject ? ( + <> + + + + ) : ( +

No project selected

+ )} +
+
+
+
- - {/* Stats Grid */} -
- {stats.map(stat => { - const Icon = stat.icon; - return ( - - -
- {stat.name} - -
- {stat.value} -
-
- ); - })} -
- - {/* Quick Actions & API Keys */} -
- {/* Quick Start */} - - - {/* API Keys */} - - - API Keys - Use these keys to integrate with Plunk - - -
- {activeProject ? ( - <> - - - - ) : ( -

No project selected

- )} -
-
-
-
-
-
+ ); }