Skip to content

Commit

Permalink
refs #921 feat: update plan prices when tier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Jan 7, 2025
1 parent 3d2fd77 commit 0ef432e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/Pricing/Plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ export const SubscriptionPlans = ({ featuresRef }: { featuresRef?: MutableRefObj
popular: plan.id === PlanId.Essential,
title: translations[plan.id]?.title || plan.name,
subtitle: translations[plan.id]?.subtitle || '',
price: currency(plan.startingPrice),
price: currency(
selectedCensusSize
? (plan.censusSizeTiers?.find((tier) => tier.upTo === selectedCensusSize)?.amount ?? plan.startingPrice)
: plan.startingPrice
),
features: translations[plan.id]?.features || [],
isDisabled:
(selectedCensusSize && !plan.censusSizeTiers?.some((tier) => tier.upTo === selectedCensusSize)) ||
Expand Down Expand Up @@ -273,9 +277,7 @@ export const SubscriptionModal = ({
<Modal isOpen={isOpen} onClose={onClose} variant='pricing-modal' size='full'>
<ModalOverlay />
<ModalContent>
<ModalHeader>
{title || <Trans i18nKey='pricing.upgrade_title'>You need to upgrade to use this feature</Trans>}
</ModalHeader>
<ModalHeader>{title || <Trans i18nKey='pricing.upgrade_title'>Upgrade your subscription</Trans>}</ModalHeader>
<ModalCloseButton />
<ModalBody>
<SubscriptionPlans />
Expand Down

0 comments on commit 0ef432e

Please sign in to comment.