fix: Hide upsell banner if billing is not configured

This commit is contained in:
Dries Augustyns
2025-12-09 08:45:53 +01:00
parent 77089fcdd6
commit 433e796c04
+17 -7
View File
@@ -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 = [
{
@@ -58,22 +60,30 @@ export default function Index() {
<AlertCircle className="h-4 w-4" />
<AlertTitle>Project Disabled - Read-Only Mode</AlertTitle>
<AlertDescription>
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.
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.
</AlertDescription>
</Alert>
)}
{/* Subscription Warning Banner */}
{activeProject && !activeProject.disabled && !activeProject.subscription && (
{activeProject &&
!activeProject.disabled &&
!activeProject.subscription &&
config?.features.billing.enabled && (
<Alert variant="warning">
<AlertCircle className="h-4 w-4" />
<AlertTitle>Upgrade to remove Plunk branding</AlertTitle>
<AlertDescription className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
<span className="text-sm">Your emails currently include Plunk branding. Upgrade to a subscription to remove it.</span>
<span className="text-sm">
Your emails currently include Plunk branding. Upgrade to a subscription to remove it.
</span>
<Link href="/settings?tab=billing">
<Button size="sm" className="w-full sm:w-auto">Upgrade Now</Button>
<Button size="sm" className="w-full sm:w-auto">
Upgrade Now
</Button>
</Link>
</AlertDescription>
</Alert>