Skip to content

Commit 275fdf1

Browse files
fix: Don't show the credits if the credit billing system is disabled
1 parent 5a1f4a0 commit 275fdf1

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/components/nav-user.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import useSignOut from "@/hooks/useSignOut"
4141
import { useRouter } from "next/navigation"
4242
import { useSessionStore } from "@/state/session"
4343
import { useTheme } from "next-themes"
44+
import { DISABLE_CREDIT_BILLING_SYSTEM } from "@/constants"
4445

4546
export function NavUser() {
4647
const { session, isLoading } = useSessionStore();
@@ -93,12 +94,14 @@ export function NavUser() {
9394
<div className="grid flex-1 gap-0.5 text-left text-sm leading-tight">
9495
<span className="font-semibold overflow-hidden text-ellipsis whitespace-nowrap">{displayName}</span>
9596
<span className="truncate text-xs text-muted-foreground">{user.email}</span>
96-
<Badge variant="secondary" className="w-fit text-[10px]" onClick={() => {
97-
setOpenMobile(false)
98-
router.push('/dashboard/billing')
99-
}}>
100-
{user.currentCredits} credits
101-
</Badge>
97+
{!DISABLE_CREDIT_BILLING_SYSTEM && (
98+
<Badge variant="secondary" className="w-fit text-[10px]" onClick={() => {
99+
setOpenMobile(false)
100+
router.push('/dashboard/billing')
101+
}}>
102+
{user.currentCredits} credits
103+
</Badge>
104+
)}
102105
</div>
103106
<ChevronsUpDown className="ml-auto size-4" />
104107
</SidebarMenuButton>
@@ -118,9 +121,11 @@ export function NavUser() {
118121
<div className="grid flex-1 gap-0.5 text-left text-sm leading-tight">
119122
<span className="font-semibold">{displayName}</span>
120123
<span className="truncate text-xs text-muted-foreground">{user.email}</span>
121-
<Badge variant="secondary" className="w-fit text-[10px]">
122-
{user.currentCredits} credits
123-
</Badge>
124+
{!DISABLE_CREDIT_BILLING_SYSTEM && (
125+
<Badge variant="secondary" className="w-fit text-[10px]">
126+
{user.currentCredits} credits
127+
</Badge>
128+
)}
124129
</div>
125130
</div>
126131
</DropdownMenuLabel>

0 commit comments

Comments
 (0)