Skip to content

Commit

Permalink
getting upgrade price from UpgradIntro.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony-MK committed Jan 7, 2025
1 parent b3690f8 commit 7295de6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/workspace/upgrade/UpgradeIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi
const preferredCurrency = usePreferredCurrency();

const formattedPrice = React.useMemo(() => {
const upgradePlan = isCategorizing ? CONST.POLICY.TYPE.TEAM : CONST.POLICY.TYPE.CORPORATE;
const upgradeCurrency = Object.hasOwn(CONST.SUBSCRIPTION_PRICES, preferredCurrency) ? preferredCurrency : CONST.PAYMENT_CARD_CURRENCY.USD;
const upgradePrice = CONST.SUBSCRIPTION_PRICES[upgradeCurrency][upgradePlan][CONST.SUBSCRIPTION.TYPE.ANNUAL];
return `${convertToShortDisplayString(upgradePrice, upgradeCurrency)} `;
return convertToShortDisplayString(
CONST.SUBSCRIPTION_PRICES[upgradeCurrency][isCategorizing ? CONST.POLICY.TYPE.TEAM : CONST.POLICY.TYPE.CORPORATE][CONST.SUBSCRIPTION.TYPE.ANNUAL],
upgradeCurrency,
);
}, [preferredCurrency, isCategorizing]);

if (!feature) {
return (
<GenericFeaturesView
onUpgrade={onUpgrade}
buttonDisabled={buttonDisabled}
formattedPrice={formattedPrice}
loading={loading}
/>
);
Expand Down Expand Up @@ -87,7 +89,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi
<Text style={[styles.textNormal, styles.textSupporting, styles.mb4]}>{translate(feature.description)}</Text>
<Text style={[styles.textNormal, styles.textSupporting]}>
{translate(`workspace.upgrade.${feature.id}.onlyAvailableOnPlan`)}
<Text style={[styles.textSupporting, styles.textBold]}>{formattedPrice}</Text>
<Text style={[styles.textSupporting, styles.textBold]}>{`${formattedPrice} `}</Text>
{translate(`workspace.upgrade.pricing.perActiveMember`)}
</Text>
</View>
Expand Down

0 comments on commit 7295de6

Please sign in to comment.