chore: optimize upgrade card config

This commit is contained in:
javayhu 2025-05-30 13:28:03 +08:00
parent e27a7a081c
commit 1a4917c874
2 changed files with 6 additions and 3 deletions

View File

@ -77,9 +77,7 @@ export function DashboardSidebar({
{!isPending && mounted && (
<>
{/* show upgrade card if user is not a member, and sidebar is not collapsed */}
{currentUser &&
state !== 'collapsed' &&
websiteConfig.features.enableUpgradeCard && <UpgradeCard />}
{currentUser && state !== 'collapsed' && <UpgradeCard />}
{/* show user profile if user is logged in */}
{currentUser && <SidebarUser user={currentUser} />}

View File

@ -8,6 +8,7 @@ import {
CardHeader,
CardTitle,
} from '@/components/ui/card';
import { websiteConfig } from '@/config/website';
import { usePayment } from '@/hooks/use-payment';
import { LocaleLink } from '@/i18n/navigation';
import { Routes } from '@/routes';
@ -16,6 +17,10 @@ import { useTranslations } from 'next-intl';
import { useEffect, useState } from 'react';
export function UpgradeCard() {
if (!websiteConfig.features.enableUpgradeCard) {
return null;
}
const t = useTranslations('Dashboard.upgrade');
const [mounted, setMounted] = useState(false);
const { isLoading, currentPlan, subscription } = usePayment();