From 18ad3d43f39c99d6eeca36907f0afb1745f183c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jasikowski?= Date: Thu, 28 Nov 2024 18:54:33 +0100 Subject: [PATCH] Merge pull request #53255 from nkdengineer/fix/53247 fix learn more link if no workspace (cherry picked from commit 41f9122409e2ab183415cb69dc7bd1999cc1c137) (CP triggered by mountiny) --- src/pages/workspace/upgrade/UpgradeIntro.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/upgrade/UpgradeIntro.tsx b/src/pages/workspace/upgrade/UpgradeIntro.tsx index 0483586f282e..d45e27905c28 100644 --- a/src/pages/workspace/upgrade/UpgradeIntro.tsx +++ b/src/pages/workspace/upgrade/UpgradeIntro.tsx @@ -9,9 +9,12 @@ import * as Expensicon from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; import Text from '@components/Text'; import TextLink from '@components/TextLink'; +import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useSubscriptionPlan from '@hooks/useSubscriptionPlan'; import useThemeStyles from '@hooks/useThemeStyles'; +import {openLink} from '@libs/actions/Link'; import Navigation from '@libs/Navigation/Navigation'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; @@ -28,6 +31,8 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi const styles = useThemeStyles(); const {isExtraSmallScreenWidth} = useResponsiveLayout(); const {translate} = useLocalize(); + const {environmentURL} = useEnvironment(); + const subscriptionPlan = useSubscriptionPlan(); const isIllustration = feature.icon in Illustrations; const iconSrc = isIllustration ? Illustrations[feature.icon as keyof typeof Illustrations] : Expensicon[feature.icon as keyof typeof Expensicon]; @@ -81,7 +86,13 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi {translate('workspace.upgrade.note.upgradeWorkspace')}{' '} Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION)} + onPress={() => { + if (!subscriptionPlan) { + openLink(CONST.PLAN_TYPES_AND_PRICING_HELP_URL, environmentURL); + return; + } + Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION); + }} > {translate('workspace.upgrade.note.learnMore')} {' '}