Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ export default {
saveTheWorld: 'Save the world',
},
allSettingsScreen: {
subscriptions: 'Subscriptions',
subscription: 'Subscription',
cardsAndDomains: 'Cards & Domains',
},
tabSelector: {
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export default {
saveTheWorld: 'Salvar el mundo',
},
allSettingsScreen: {
subscriptions: 'Suscripciones',
subscription: 'Suscripcion',
cardsAndDomains: 'Tarjetas y Dominios',
},
tabSelector: {
Expand Down
8 changes: 0 additions & 8 deletions src/libs/shouldShowSubscriptionsMenu/index.native.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/libs/shouldShowSubscriptionsMenu/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/libs/shouldShowSubscriptionsMenu/types.tsx

This file was deleted.

11 changes: 6 additions & 5 deletions src/pages/home/sidebar/AllSettingsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useMemo} from 'react';
import type {OnyxCollection} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import {useOnyx, withOnyx} from 'react-native-onyx';
import Breadcrumbs from '@components/Breadcrumbs';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItemList from '@components/MenuItemList';
Expand All @@ -11,7 +11,6 @@ import useThemeStyles from '@hooks/useThemeStyles';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import useWindowDimensions from '@hooks/useWindowDimensions';
import Navigation from '@libs/Navigation/Navigation';
import shouldShowSubscriptionsMenu from '@libs/shouldShowSubscriptionsMenu';
import {hasGlobalWorkspaceSettingsRBR} from '@libs/WorkspacesSettingsUtils';
import * as Link from '@userActions/Link';
import CONST from '@src/CONST';
Expand All @@ -32,6 +31,8 @@ function AllSettingsScreen({policies}: AllSettingsScreenProps) {
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();

const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION);

/**
* Retuns a list of menu items data for All workspaces settings
* @returns {Object} object with translationKey, style and items
Expand All @@ -49,10 +50,10 @@ function AllSettingsScreen({policies}: AllSettingsScreenProps) {
focused: !isSmallScreenWidth,
brickRoadIndicator: hasGlobalWorkspaceSettingsRBR(policies) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
},
...(shouldShowSubscriptionsMenu
...(privateSubscription

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not considering an active subscription plan based on control/collect workspace for display of subscription menu resulted in #45720

? [
{
translationKey: 'allSettingsScreen.subscriptions',
translationKey: 'allSettingsScreen.subscription',
icon: Expensicons.MoneyBag,
action: () => {
Link.openOldDotLink(CONST.OLDDOT_URLS.ADMIN_POLICIES_URL);
Expand Down Expand Up @@ -89,7 +90,7 @@ function AllSettingsScreen({policies}: AllSettingsScreenProps) {
hoverAndPressStyle: styles.hoveredComponentBG,
brickRoadIndicator: item.brickRoadIndicator,
}));
}, [isSmallScreenWidth, styles.hoveredComponentBG, styles.sectionMenuItem, translate, waitForNavigate, policies]);
}, [isSmallScreenWidth, policies, privateSubscription, waitForNavigate, translate, styles]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
}, [isSmallScreenWidth, policies, privateSubscription, waitForNavigate, translate, styles]);
}, [isSmallScreenWidth, policies, privateSubscription, waitForNavigate, translate, styles.hoveredComponentBG, styles.sectionMenuItem]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB as this component is not used anywhere in the app


return (
<ScreenWrapper
Expand Down
21 changes: 9 additions & 12 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {useCallback, useContext, useEffect, useLayoutEffect, useMemo, use
import type {GestureResponderEvent, ScrollView as RNScrollView, ScrollViewProps, StyleProp, ViewStyle} from 'react-native';
import {NativeModules, View} from 'react-native';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import {useOnyx, withOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import AvatarWithImagePicker from '@components/AvatarWithImagePicker';
import ConfirmModal from '@components/ConfirmModal';
Expand All @@ -29,7 +29,6 @@ import useThemeStyles from '@hooks/useThemeStyles';
import useWaitForNavigation from '@hooks/useWaitForNavigation';
import * as CurrencyUtils from '@libs/CurrencyUtils';
import Navigation from '@libs/Navigation/Navigation';
import shouldShowSubscriptionsMenu from '@libs/shouldShowSubscriptionsMenu';
import * as SubscriptionUtils from '@libs/SubscriptionUtils';
import * as UserUtils from '@libs/UserUtils';
import {hasGlobalWorkspaceSettingsRBR} from '@libs/WorkspacesSettingsUtils';
Expand Down Expand Up @@ -108,6 +107,8 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa
const activeRoute = useActiveRoute();
const emojiCode = currentUserPersonalDetails?.status?.emojiCode ?? '';

const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION);

const [shouldShowSignoutConfirmModal, setShouldShowSignoutConfirmModal] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -202,16 +203,12 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa
},
];

if (shouldShowSubscriptionsMenu) {
if (privateSubscription) {
items.splice(1, 0, {
translationKey: 'allSettingsScreen.subscriptions',
icon: Expensicons.MoneyBag,
action: () => {
Link.openOldDotLink(CONST.OLDDOT_URLS.ADMIN_POLICIES_URL);
},
shouldShowRightIcon: true,
iconRight: Expensicons.NewWindow,
link: () => Link.buildOldDotURL(CONST.OLDDOT_URLS.ADMIN_POLICIES_URL),
translationKey: 'allSettingsScreen.subscription',
icon: Expensicons.CreditCard,
routeName: ROUTES.SETTINGS_SUBSCRIPTION,
brickRoadIndicator: !!privateSubscription?.errors || SubscriptionUtils.hasSubscriptionRedDotError() ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
badgeText: SubscriptionUtils.isUserOnFreeTrial() ? translate('subscription.badge.freeTrial', {numOfDays: SubscriptionUtils.calculateRemainingFreeTrialDays()}) : undefined,
badgeStyle: SubscriptionUtils.isUserOnFreeTrial() ? styles.badgeSuccess : undefined,
});
Expand All @@ -222,7 +219,7 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa
sectionTranslationKey: 'common.workspaces',
items,
};
}, [policies, styles.badgeSuccess, styles.workspaceSettingsSectionContainer, translate]);
}, [policies, privateSubscription, styles.badgeSuccess, styles.workspaceSettingsSectionContainer, translate]);

/**
* Retuns a list of menu items data for general section
Expand Down
5 changes: 5 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ const styles = (theme: ThemeColors) =>
flex: 1,
},

lhnSuccessText: {
color: theme.success,
fontWeight: FontUtils.fontWeight.bold,
},

Comment on lines +1437 to +1441

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
lhnSuccessText: {
color: theme.success,
fontWeight: FontUtils.fontWeight.bold,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB: unused style

signInPageHeroCenter: {
position: 'absolute',
top: 0,
Expand Down