Refactor billing components and enhance UX

This commit includes significant changes to the layout and presentation of billing related components. The most notable updates are replacing the static back button in 'billing-session-status.tsx' with a fully clickable link button, and improving the product description lookup to use i18n in 'current-subscription-card.tsx'. Additionally, the general structure and spacing of elements within 'billing/page.tsx' are enhanced for better user experience.
This commit is contained in:
giancarlo
2024-04-14 19:44:18 +08:00
parent 131b06fae6
commit 7fab6d7335
3 changed files with 36 additions and 33 deletions

View File

@@ -75,28 +75,24 @@ async function TeamAccountBillingPage({ params }: Params) {
/>
<PageBody>
<div className={'mx-auto w-full'}>
<div>
<div className={'flex flex-col space-y-6'}>
<If
condition={subscription}
fallback={
<>
<Checkout />
</>
}
>
{(subscription) => (
<CurrentSubscriptionCard
subscription={subscription}
config={billingConfig}
/>
)}
</If>
<div className={'mx-auto flex w-full max-w-2xl flex-col space-y-6'}>
<If
condition={subscription}
fallback={
<>
<Checkout />
</>
}
>
{(subscription) => (
<CurrentSubscriptionCard
subscription={subscription}
config={billingConfig}
/>
)}
</If>
<BillingPortal />
</div>
</div>
<BillingPortal />
</div>
</PageBody>
</>

View File

@@ -78,17 +78,15 @@ function SuccessSessionStatus({
</p>
</div>
<Button data-test={'checkout-success-back-button'} variant={'outline'}>
<Link href={redirectPath}>
<span className={'flex items-center space-x-2.5'}>
<span>
<Trans i18nKey={'billing:checkoutSuccessBackButton'} />
</span>
<ChevronRight className={'h-4'} />
<Link data-test={'checkout-success-back-link'} href={redirectPath}>
<Button>
<span>
<Trans i18nKey={'billing:checkoutSuccessBackButton'} />
</span>
</Link>
</Button>
<ChevronRight className={'h-4'} />
</Button>
</Link>
</div>
</section>
);

View File

@@ -65,7 +65,7 @@ export function CurrentSubscriptionCard({
</CardDescription>
</CardHeader>
<CardContent className={'space-y-3 text-sm'}>
<CardContent className={'space-y-4 border-t pt-4 text-sm'}>
<div className={'flex flex-col space-y-1'}>
<div className={'flex items-center space-x-2 text-lg font-semibold'}>
<BadgeCheck
@@ -75,11 +75,20 @@ export function CurrentSubscriptionCard({
/>
<span data-test={'current-plan-card-product-name'}>
{product.name}
<Trans i18nKey={product.name} defaults={product.name} />
</span>
<CurrentPlanBadge status={subscription.status} />
</div>
<div>
<p className={'text-muted-foreground'}>
<Trans
i18nKey={product.description}
defaults={product.description}
/>
</p>
</div>
</div>
{/*