Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] fix learn more link if no workspace #53255

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/pages/workspace/upgrade/UpgradeIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,6 +32,8 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi
const styles = useThemeStyles();
const {isExtraSmallScreenWidth} = useResponsiveLayout();
const {translate} = useLocalize();
const {environmentURL} = useEnvironment();
const subscriptionPlan = useSubscriptionPlan();

if (!feature) {
return (
Expand Down Expand Up @@ -91,7 +96,13 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading, isCategorizi
{translate('workspace.upgrade.note.upgradeWorkspace')}{' '}
<TextLink
style={[styles.link]}
onPress={() => 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')}
</TextLink>{' '}
Expand Down