Skip to content

Commit

Permalink
minor: hide change subscription button for free tier
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Dec 30, 2024
1 parent 92b6467 commit 495b6cd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/Organization/Subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ApiEndpoints } from '~components/Auth/api'
import { useSubscription } from '~components/Auth/Subscription'
import { useAuth } from '~components/Auth/useAuth'
import { usePricingModal } from '~components/Pricing/use-pricing-modal'
import { PlanId } from '~constants'
import { Routes } from '~src/router/routes'
import { currency } from '~utils/numbers'

Expand Down Expand Up @@ -82,6 +83,8 @@ export const SubscriptionList = () => {
})
})

const isFree = subscription.plan.id === PlanId.Free

return (
<VStack gap={4} w='full'>
{!subscription.subscriptionDetails.active && (
Expand Down Expand Up @@ -114,7 +117,7 @@ export const SubscriptionList = () => {
<Th>
<Trans i18nKey='subscription.since'>Since</Trans>
</Th>
<Th colSpan={2}>
<Th colSpan={isFree ? 1 : 2}>
<Trans i18nKey='subscription.next_billing'>Next Billing</Trans>
</Th>
</Tr>
Expand All @@ -134,11 +137,13 @@ export const SubscriptionList = () => {
<Td>
<Tag>{new Date(subscription.subscriptionDetails.renewalDate).toLocaleDateString()}</Tag>
</Td>
<Td>
<Button variant='outline' size='sm' isLoading={isLoading} onClick={() => handleChangeClick()}>
<Trans i18nKey='subscription.change_plan_button'>Change</Trans>
</Button>
</Td>
{!isFree && (
<Td>
<Button variant='outline' size='sm' isLoading={isLoading} onClick={() => handleChangeClick()}>
<Trans i18nKey='subscription.change_plan_button'>Change</Trans>
</Button>
</Td>
)}
</Tr>
</Tbody>
</Table>
Expand Down

3 comments on commit 495b6cd

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elboletaire
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this has been done because the stripe portal session cannot be initialized for clients not having an active subscription. It would probably be better to always show it if you had any subscription anytime, but I'm not sure how could I get such info @emmdim

Please sign in to comment.