Skip to content

Commit 438639b

Browse files
authored
Revert "Add manager mctest tooltips to create expense flow"
1 parent cda4170 commit 438639b

File tree

11 files changed

+76
-216
lines changed

11 files changed

+76
-216
lines changed

src/CONST.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6695,8 +6695,6 @@ const CONST = {
66956695
LHN_WORKSPACE_CHAT_TOOLTIP: 'workspaceChatLHNTooltip',
66966696
GLOBAL_CREATE_TOOLTIP: 'globalCreateTooltip',
66976697
SCAN_TEST_TOOLTIP: 'scanTestTooltip',
6698-
SCAN_TEST_TOOLTIP_MANAGER: 'scanTestTooltipManager',
6699-
SCAN_TEST_CONFIRMATION: 'scanTestConfirmation',
67006698
},
67016699
SMART_BANNER_HEIGHT: 152,
67026700

src/components/MoneyRequestConfirmationList.tsx

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ import {calculateAmount, insertTagIntoTransactionTagsString, isMovingTransaction
3131
import Log from '@libs/Log';
3232
import {validateAmount} from '@libs/MoneyRequestUtils';
3333
import Navigation from '@libs/Navigation/Navigation';
34-
import {getIOUConfirmationOptionsFromPayeePersonalDetail, hasEnabledOptions, isSelectedManagerMcTest} from '@libs/OptionsListUtils';
35-
import Permissions from '@libs/Permissions';
34+
import {getIOUConfirmationOptionsFromPayeePersonalDetail, hasEnabledOptions} from '@libs/OptionsListUtils';
3635
import {getDistanceRateCustomUnitRate, getTagLists, isTaxTrackingEnabled} from '@libs/PolicyUtils';
3736
import type {OptionData} from '@libs/ReportUtils';
3837
import playSound, {SOUNDS} from '@libs/Sound';
@@ -66,13 +65,11 @@ import FormHelpMessage from './FormHelpMessage';
6665
import MoneyRequestAmountInput from './MoneyRequestAmountInput';
6766
import MoneyRequestConfirmationListFooter from './MoneyRequestConfirmationListFooter';
6867
import {PressableWithFeedback} from './Pressable';
69-
import {useProductTrainingContext} from './ProductTrainingContext';
7068
import SelectionList from './SelectionList';
7169
import type {SectionListDataType} from './SelectionList/types';
7270
import UserListItem from './SelectionList/UserListItem';
7371
import SettlementButton from './SettlementButton';
7472
import Text from './Text';
75-
import EducationalTooltip from './Tooltip/EducationalTooltip';
7673

7774
type MoneyRequestConfirmationListProps = {
7875
/** Callback to inform parent modal of success */
@@ -218,11 +215,6 @@ function MoneyRequestConfirmationList({
218215
const [policyCategoriesDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT}${policyID}`);
219216
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES);
220217
const [currencyList] = useOnyx(ONYXKEYS.CURRENCY_LIST);
221-
const [betas] = useOnyx(ONYXKEYS.BETAS);
222-
const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip} = useProductTrainingContext(
223-
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_CONFIRMATION,
224-
Permissions.canUseManagerMcTest(betas) && selectedParticipantsProp.some((participant) => isSelectedManagerMcTest(participant.login)),
225-
);
226218

227219
const policy = policyReal ?? policyDraft;
228220
const policyCategories = policyCategoriesReal ?? policyCategoriesDraft;
@@ -974,37 +966,11 @@ function MoneyRequestConfirmationList({
974966
message={errorMessage}
975967
/>
976968
)}
977-
<EducationalTooltip
978-
shouldRender={shouldShowProductTrainingTooltip}
979-
renderTooltipContent={renderProductTrainingTooltip}
980-
anchorAlignment={{
981-
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.CENTER,
982-
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
983-
}}
984-
wrapperStyle={styles.productTrainingTooltipWrapper}
985-
shouldHideOnNavigate
986-
shiftVertical={-10}
987-
>
988-
<View>{button}</View>
989-
</EducationalTooltip>
969+
970+
{button}
990971
</>
991972
);
992-
}, [
993-
isReadOnly,
994-
iouType,
995-
confirm,
996-
bankAccountRoute,
997-
iouCurrencyCode,
998-
policyID,
999-
isConfirmed,
1000-
splitOrRequestOptions,
1001-
errorMessage,
1002-
styles.ph1,
1003-
styles.mb2,
1004-
styles.productTrainingTooltipWrapper,
1005-
shouldShowProductTrainingTooltip,
1006-
renderProductTrainingTooltip,
1007-
]);
973+
}, [isReadOnly, iouType, confirm, isConfirmed, bankAccountRoute, iouCurrencyCode, policyID, splitOrRequestOptions, styles.ph1, styles.mb2, errorMessage]);
1008974

1009975
const listFooterContent = (
1010976
<MoneyRequestConfirmationListFooter

src/components/ProductTrainingContext/TOOLTIPS.ts

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const {
1313
LHN_WORKSPACE_CHAT_TOOLTIP,
1414
GLOBAL_CREATE_TOOLTIP,
1515
SCAN_TEST_TOOLTIP,
16-
SCAN_TEST_TOOLTIP_MANAGER,
17-
SCAN_TEST_CONFIRMATION,
1816
} = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES;
1917

2018
type ProductTrainingTooltipName = ValueOf<typeof CONST.PRODUCT_TRAINING_TOOLTIP_NAMES>;
@@ -121,34 +119,18 @@ const TOOLTIPS: Record<ProductTrainingTooltipName, TooltipData> = {
121119
content: [
122120
{text: 'productTrainingTooltip.scanTestTooltip.part1', isBold: false},
123121
{text: 'productTrainingTooltip.scanTestTooltip.part2', isBold: true},
124-
],
125-
onHideTooltip: () => dismissProductTraining(SCAN_TEST_TOOLTIP),
126-
name: SCAN_TEST_TOOLTIP,
127-
priority: 900,
128-
shouldShow: () => true,
129-
shouldRenderActionButtons: true,
130-
},
131-
[SCAN_TEST_TOOLTIP_MANAGER]: {
132-
content: [
133122
{text: 'productTrainingTooltip.scanTestTooltip.part3', isBold: false},
134123
{text: 'productTrainingTooltip.scanTestTooltip.part4', isBold: true},
135124
{text: 'productTrainingTooltip.scanTestTooltip.part5', isBold: false},
136-
],
137-
onHideTooltip: () => dismissProductTraining(SCAN_TEST_TOOLTIP_MANAGER),
138-
name: SCAN_TEST_TOOLTIP_MANAGER,
139-
priority: 1000,
140-
shouldShow: () => true,
141-
},
142-
[SCAN_TEST_CONFIRMATION]: {
143-
content: [
144125
{text: 'productTrainingTooltip.scanTestTooltip.part6', isBold: false},
145126
{text: 'productTrainingTooltip.scanTestTooltip.part7', isBold: true},
146127
{text: 'productTrainingTooltip.scanTestTooltip.part8', isBold: false},
147128
],
148-
onHideTooltip: () => dismissProductTraining(SCAN_TEST_CONFIRMATION),
149-
name: SCAN_TEST_CONFIRMATION,
150-
priority: 1100,
151-
shouldShow: () => true,
129+
onHideTooltip: () => dismissProductTraining(SCAN_TEST_TOOLTIP),
130+
name: SCAN_TEST_TOOLTIP,
131+
priority: 900,
132+
shouldShow: () => false,
133+
shouldRenderActionButtons: true,
152134
},
153135
};
154136

src/components/ProductTrainingContext/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,7 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
101101
}
102102

103103
// We need to make an exception for the QAB tooltip because it is shown in a modal, otherwise it would be hidden if a modal is visible
104-
if (
105-
tooltipName !== CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.QUICK_ACTION_BUTTON &&
106-
tooltipName !== CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP &&
107-
tooltipName !== CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER &&
108-
tooltipName !== CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_CONFIRMATION &&
109-
isModalVisible
110-
) {
104+
if (tooltipName !== CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.QUICK_ACTION_BUTTON && isModalVisible) {
111105
return false;
112106
}
113107

@@ -137,6 +131,7 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
137131
return false;
138132
}
139133
const visibleTooltip = determineVisibleTooltip();
134+
140135
// If this is the highest priority visible tooltip, show it
141136
if (tooltipName === visibleTooltip) {
142137
return true;
@@ -254,6 +249,7 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
254249
const shouldShowProductTrainingTooltip = useMemo(() => {
255250
return shouldShow && shouldRenderTooltip(tooltipName);
256251
}, [shouldRenderTooltip, tooltipName, shouldShow]);
252+
257253
const hideProductTrainingTooltip = useCallback(() => {
258254
if (!shouldShowProductTrainingTooltip) {
259255
return;

src/components/SelectionList/InviteMemberListItem.tsx

Lines changed: 55 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
import {Str} from 'expensify-common';
22
import React, {useCallback} from 'react';
33
import {View} from 'react-native';
4-
import {useOnyx} from 'react-native-onyx';
54
import {FallbackAvatar} from '@components/Icon/Expensicons';
65
import MultipleAvatars from '@components/MultipleAvatars';
76
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
8-
import {useProductTrainingContext} from '@components/ProductTrainingContext';
97
import SelectCircle from '@components/SelectCircle';
108
import SubscriptAvatar from '@components/SubscriptAvatar';
119
import Text from '@components/Text';
1210
import TextWithTooltip from '@components/TextWithTooltip';
13-
import EducationalTooltip from '@components/Tooltip/EducationalTooltip';
1411
import useLocalize from '@hooks/useLocalize';
1512
import useStyleUtils from '@hooks/useStyleUtils';
1613
import useTheme from '@hooks/useTheme';
1714
import useThemeStyles from '@hooks/useThemeStyles';
18-
import {getIsUserSubmittedExpenseOrScannedReceipt, isSelectedManagerMcTest} from '@libs/OptionsListUtils';
19-
import Permissions from '@libs/Permissions';
2015
import CONST from '@src/CONST';
21-
import ONYXKEYS from '@src/ONYXKEYS';
2216
import type {Icon} from '@src/types/onyx/OnyxCommon';
2317
import BaseListItem from './BaseListItem';
2418
import type {InviteMemberListItemProps, ListItem} from './types';
@@ -48,11 +42,6 @@ function InviteMemberListItem<TItem extends ListItem>({
4842
const theme = useTheme();
4943
const StyleUtils = useStyleUtils();
5044
const {translate} = useLocalize();
51-
const [betas] = useOnyx(ONYXKEYS.BETAS);
52-
const {renderProductTrainingTooltip, shouldShowProductTrainingTooltip} = useProductTrainingContext(
53-
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.SCAN_TEST_TOOLTIP_MANAGER,
54-
!getIsUserSubmittedExpenseOrScannedReceipt() && Permissions.canUseManagerMcTest(betas) && isSelectedManagerMcTest(item.login),
55-
);
5645

5746
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
5847
const subscriptAvatarBorderColor = isFocused ? focusedBackgroundColor : theme.sidebar;
@@ -95,75 +84,64 @@ function InviteMemberListItem<TItem extends ListItem>({
9584
shouldDisplayRBR={!shouldShowCheckBox}
9685
>
9786
{(hovered?: boolean) => (
98-
<EducationalTooltip
99-
shouldRender={shouldShowProductTrainingTooltip}
100-
renderTooltipContent={renderProductTrainingTooltip}
101-
anchorAlignment={{
102-
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
103-
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
104-
}}
105-
shouldHideOnNavigate
106-
wrapperStyle={styles.productTrainingTooltipWrapper}
107-
>
108-
<View style={[styles.flexRow, styles.alignItemsCenter, styles.flex1]}>
109-
{!!item.icons &&
110-
(item.shouldShowSubscript ? (
111-
<SubscriptAvatar
112-
mainAvatar={item.icons.at(0) ?? fallbackIcon}
113-
secondaryAvatar={item.icons.at(1)}
114-
showTooltip={showTooltip}
115-
backgroundColor={hovered && !isFocused ? hoveredBackgroundColor : subscriptAvatarBorderColor}
116-
/>
117-
) : (
118-
<MultipleAvatars
119-
icons={item.icons}
120-
shouldShowTooltip={showTooltip}
121-
secondAvatarStyle={[
122-
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar),
123-
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined,
124-
hovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined,
125-
]}
126-
/>
127-
))}
128-
<View style={[styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch, styles.optionRow]}>
129-
<View style={[styles.flexRow, styles.alignItemsCenter]}>
130-
<TextWithTooltip
131-
shouldShowTooltip={showTooltip}
132-
text={Str.removeSMSDomain(item.text ?? '')}
133-
style={[
134-
styles.optionDisplayName,
135-
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText,
136-
item.isBold !== false && styles.sidebarLinkTextBold,
137-
styles.pre,
138-
item.alternateText ? styles.mb1 : null,
139-
]}
140-
/>
141-
</View>
142-
{!!item.alternateText && (
143-
<TextWithTooltip
144-
shouldShowTooltip={showTooltip}
145-
text={Str.removeSMSDomain(item.alternateText ?? '')}
146-
style={[styles.textLabelSupporting, styles.lh16, styles.pre]}
147-
/>
148-
)}
87+
<>
88+
{!!item.icons &&
89+
(item.shouldShowSubscript ? (
90+
<SubscriptAvatar
91+
mainAvatar={item.icons.at(0) ?? fallbackIcon}
92+
secondaryAvatar={item.icons.at(1)}
93+
showTooltip={showTooltip}
94+
backgroundColor={hovered && !isFocused ? hoveredBackgroundColor : subscriptAvatarBorderColor}
95+
/>
96+
) : (
97+
<MultipleAvatars
98+
icons={item.icons}
99+
shouldShowTooltip={showTooltip}
100+
secondAvatarStyle={[
101+
StyleUtils.getBackgroundAndBorderStyle(theme.sidebar),
102+
isFocused ? StyleUtils.getBackgroundAndBorderStyle(focusedBackgroundColor) : undefined,
103+
hovered && !isFocused ? StyleUtils.getBackgroundAndBorderStyle(hoveredBackgroundColor) : undefined,
104+
]}
105+
/>
106+
))}
107+
<View style={[styles.flex1, styles.flexColumn, styles.justifyContentCenter, styles.alignItemsStretch, styles.optionRow]}>
108+
<View style={[styles.flexRow, styles.alignItemsCenter]}>
109+
<TextWithTooltip
110+
shouldShowTooltip={showTooltip}
111+
text={Str.removeSMSDomain(item.text ?? '')}
112+
style={[
113+
styles.optionDisplayName,
114+
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText,
115+
item.isBold !== false && styles.sidebarLinkTextBold,
116+
styles.pre,
117+
item.alternateText ? styles.mb1 : null,
118+
]}
119+
/>
149120
</View>
150-
{!!item.rightElement && item.rightElement}
151-
{!!shouldShowCheckBox && (
152-
<PressableWithFeedback
153-
onPress={handleCheckboxPress}
154-
disabled={isDisabled}
155-
role={CONST.ROLE.BUTTON}
156-
accessibilityLabel={item.text ?? ''}
157-
style={[styles.ml2, styles.optionSelectCircle]}
158-
>
159-
<SelectCircle
160-
isChecked={item.isSelected ?? false}
161-
selectCircleStyles={styles.ml0}
162-
/>
163-
</PressableWithFeedback>
121+
{!!item.alternateText && (
122+
<TextWithTooltip
123+
shouldShowTooltip={showTooltip}
124+
text={Str.removeSMSDomain(item.alternateText ?? '')}
125+
style={[styles.textLabelSupporting, styles.lh16, styles.pre]}
126+
/>
164127
)}
165128
</View>
166-
</EducationalTooltip>
129+
{!!item.rightElement && item.rightElement}
130+
{!!shouldShowCheckBox && (
131+
<PressableWithFeedback
132+
onPress={handleCheckboxPress}
133+
disabled={isDisabled}
134+
role={CONST.ROLE.BUTTON}
135+
accessibilityLabel={item.text ?? ''}
136+
style={[styles.ml2, styles.optionSelectCircle]}
137+
>
138+
<SelectCircle
139+
isChecked={item.isSelected ?? false}
140+
selectCircleStyles={styles.ml0}
141+
/>
142+
</PressableWithFeedback>
143+
)}
144+
</>
167145
)}
168146
</BaseListItem>
169147
);

0 commit comments

Comments
 (0)