diff --git a/web/app/(app)/dashboard/(components)/dashboard-layout.tsx b/web/app/(app)/dashboard/(components)/dashboard-layout.tsx index 8f4cd91..e7a3abe 100644 --- a/web/app/(app)/dashboard/(components)/dashboard-layout.tsx +++ b/web/app/(app)/dashboard/(components)/dashboard-layout.tsx @@ -13,7 +13,7 @@ import GenerateApiKey from './generate-api-key' import { useSession } from 'next-auth/react' import { JoinCommunityModal } from '@/components/shared/join-community-modal' import { ContributeModal } from '@/components/shared/contribute-modal' - +import UpgradeToProAlert from './upgrade-to-pro-alert' export default function Dashboard({ children, }: { @@ -66,15 +66,18 @@ export default function Dashboard({ + + + diff --git a/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx b/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx new file mode 100644 index 0000000..07b909a --- /dev/null +++ b/web/app/(app)/dashboard/(components)/upgrade-to-pro-alert.tsx @@ -0,0 +1,60 @@ +import { Alert, AlertDescription } from '@/components/ui/alert' +import { Button } from '@/components/ui/button' +import { ApiEndpoints } from '@/config/api' +import httpBrowserClient from '@/lib/httpBrowserClient' +import { useQuery } from '@tanstack/react-query' +import Link from 'next/link' + +export default function UpgradeToProAlert() { + const { + data: currentSubscription, + isLoading: isLoadingSubscription, + error: subscriptionError, + } = useQuery({ + queryKey: ['currentSubscription'], + queryFn: () => + httpBrowserClient + .get(ApiEndpoints.billing.currentSubscription()) + .then((res) => res.data), + }) + + if (isLoadingSubscription || !currentSubscription || subscriptionError) { + return null + } + + if (['pro', 'custom'].includes(currentSubscription?.plan?.name)) { + return null + } + + return ( + + + + Upgrade to Pro for exclusive features and benefits! + + + Use discount code SAVEBIG50 at checkout for a 50% + discount! + +
+ + +
+
+
+ ) +}