Skip to content

Commit

Permalink
Add plan upgrade button
Browse files Browse the repository at this point in the history
  • Loading branch information
255kb committed Jul 18, 2024
1 parent d9f68bb commit 8405e21
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pages/account/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const AccountInfo: FunctionComponent = function () {
href={'/account/subscription/'}
className='btn btn-xs btn-primary-subtle'
>
View
Manage
</Link>
</div>
</div>
Expand Down
49 changes: 32 additions & 17 deletions pages/account/subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,43 @@ const AccountSubscription: FunctionComponent = function () {
)}
</div>
<div className='col-auto'>
{userData?.plan === 'FREE' && (
<Link
href={'/account/subscribe/'}
className='btn btn-xs btn-primary'
>
Upgrade plan
</Link>
)}
{userData?.plan !== 'FREE' &&
displayPlanInfo &&
userData?.subscription?.provider ===
'stripe' && (
<div>
{userData?.plan === 'FREE' && (
<Link
href={
process.env
.NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_URL
}
href={'/account/subscribe/'}
className='btn btn-xs btn-primary'
>
Manage subscription
Upgrade plan
</Link>
)}
{userData?.plan !== 'FREE' &&
displayPlanInfo &&
userData?.subscription?.provider ===
'stripe' && (
<Link
href={
process.env
.NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_URL
}
className='btn btn-xs btn-primary'
>
Manage subscription
</Link>
)}
</div>
{(userData?.plan === 'SOLO' ||
(userData?.plan === 'TEAM' &&
userData?.teamRole === 'owner')) && (
<div>
<small className='text-gray-700 ms-auto'>
Contact us at{' '}
<a href='mailto:[email protected]'>
[email protected]
</a>{' '}
to upgrade your plan.
</small>
</div>
)}
</div>
</div>
{userData?.plan === 'FREE' &&
Expand Down

0 comments on commit 8405e21

Please sign in to comment.