1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-28 11:39:52 +02:00

Hide upgrade button for paid users.

This commit is contained in:
Kamran Ahmed
2025-07-23 16:50:43 +01:00
parent f289a74af8
commit e426b8bda8
3 changed files with 22 additions and 8 deletions

1
.astro/types.d.ts vendored
View File

@@ -1,2 +1 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />

View File

@@ -6,6 +6,7 @@ import { NavigationDropdown } from '../NavigationDropdown';
import { RoadmapDropdownMenu } from '../TopNavDropdowns/RoadmapDropdownMenu';
import { AIDropdownMenu } from '../TopNavDropdowns/AIDropdownMenu';
import { AccountDropdown } from './AccountDropdown';
import { UpgradeProButton } from '../TopNavDropdowns/UpgradeProButton';
---
<div class='bg-slate-900 py-5 text-white sm:py-8'>
@@ -31,13 +32,7 @@ import { AccountDropdown } from './AccountDropdown';
<NavigationDropdown client:load />
<RoadmapDropdownMenu client:load />
<AIDropdownMenu client:load />
<a
href='/premium'
class='group relative hidden items-center gap-1.5 font-medium text-yellow-400 transition-all duration-200 hover:text-yellow-300 xl:flex'
>
<Icon icon='bolt' />
Upgrade to Pro
</a>
<UpgradeProButton client:only='react' />
</div>
</div>

View File

@@ -0,0 +1,20 @@
import { Zap } from 'lucide-react';
import { useIsPaidUser } from '../../queries/billing';
import { cn } from '../../lib/classname';
export function UpgradeProButton() {
const { isPaidUser, isLoading } = useIsPaidUser();
return (
<a
href="/premium"
className={cn(
'group animate-fade-in relative hidden items-center gap-1.5 font-medium text-yellow-400 transition-all duration-200 hover:text-yellow-300 xl:flex',
(isPaidUser || isLoading) && 'hidden!',
)}
>
<Zap className="h-4 w-4 fill-current" />
Upgrade to Pro
</a>
);
}