Skip to content

Commit 6df7b5a

Browse files
mountinyOSBotify
authored andcommitted
Merge pull request #76021 from Expensify/mollfpr-revert-pr-75371
[CP Staging] Revert "Merge pull request #75371 from apeyada/fix-75252" (cherry picked from commit 5da44ac) (cherry-picked to staging by mountiny)
1 parent 5cc5e00 commit 6df7b5a

File tree

108 files changed

+313
-498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+313
-498
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"test:debug": "TZ=utc NODE_OPTIONS='--inspect-brk --experimental-vm-modules' jest --runInBand",
4444
"perf-test": "NODE_OPTIONS=--experimental-vm-modules npx reassure",
4545
"typecheck": "NODE_OPTIONS=--max_old_space_size=8192 tsc",
46-
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=128 --cache --cache-location=node_modules/.cache/eslint --concurrency=auto",
46+
"lint": "NODE_OPTIONS=--max_old_space_size=8192 eslint . --max-warnings=145 --cache --cache-location=node_modules/.cache/eslint --concurrency=auto",
4747
"lint-changed": "NODE_OPTIONS=--max_old_space_size=8192 ./scripts/lintChanged.sh",
4848
"check-lazy-loading": "ts-node scripts/checkLazyLoading.ts",
4949
"lint-watch": "npx eslint-watch --watch --changed",

scripts/lintChanged.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fi
3636
# Run eslint on the changed files
3737
if [[ -n "$GIT_DIFF_OUTPUT" ]] ; then
3838
# shellcheck disable=SC2086 # For multiple files in variable
39-
eslint --concurrency=auto --max-warnings=133 --config ./eslint.changed.config.mjs $GIT_DIFF_OUTPUT
39+
eslint --concurrency=auto --max-warnings=145 --config ./eslint.changed.config.mjs $GIT_DIFF_OUTPUT
4040
else
4141
info "No TypeScript files changed"
4242
fi

src/components/AccountSwitcher.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {Str} from 'expensify-common';
33
import React, {useRef, useState} from 'react';
44
import {View} from 'react-native';
55
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
6-
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
76
import useLocalize from '@hooks/useLocalize';
87
import useNetwork from '@hooks/useNetwork';
98
import useOnyx from '@hooks/useOnyx';
@@ -24,7 +23,6 @@ import type {Errors} from '@src/types/onyx/OnyxCommon';
2423
import Avatar from './Avatar';
2524
import ConfirmModal from './ConfirmModal';
2625
import Icon from './Icon';
27-
// eslint-disable-next-line no-restricted-imports
2826
import * as Expensicons from './Icon/Expensicons';
2927
import type {PopoverMenuItem} from './PopoverMenu';
3028
import PopoverMenu from './PopoverMenu';
@@ -57,7 +55,6 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
5755

5856
const buttonRef = useRef<HTMLDivElement>(null);
5957
const {windowHeight} = useWindowDimensions();
60-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['CaretUpDown'] as const);
6158

6259
const [shouldShowDelegatorMenu, setShouldShowDelegatorMenu] = useState(false);
6360
const [shouldShowOfflineModal, setShouldShowOfflineModal] = useState(false);
@@ -222,7 +219,7 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
222219
<View style={styles.justifyContentCenter}>
223220
<Icon
224221
fill={theme.icon}
225-
src={expensifyIcons.CaretUpDown}
222+
src={Expensicons.CaretUpDown}
226223
height={variables.iconSizeSmall}
227224
width={variables.iconSizeSmall}
228225
/>

src/components/AnimatedCollapsible/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import type {StyleProp, ViewStyle} from 'react-native';
55
import Animated, {useAnimatedStyle, useDerivedValue, useSharedValue, withTiming} from 'react-native-reanimated';
66
import {scheduleOnRN} from 'react-native-worklets';
77
import Icon from '@components/Icon';
8+
import * as Expensicons from '@components/Icon/Expensicons';
89
import {easing} from '@components/Modal/ReanimatedModal/utils';
910
import {PressableWithFeedback} from '@components/Pressable';
10-
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
1111
import useTheme from '@hooks/useTheme';
1212
import useThemeStyles from '@hooks/useThemeStyles';
1313
import CONST from '@src/CONST';
@@ -69,7 +69,6 @@ function AnimatedCollapsible({
6969
const contentHeight = useSharedValue(0);
7070
const hasExpanded = useSharedValue(isExpanded);
7171
const [isRendered, setIsRendered] = React.useState(isExpanded);
72-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['DownArrow', 'UpArrow'] as const);
7372

7473
useEffect(() => {
7574
hasExpanded.set(isExpanded);
@@ -122,7 +121,7 @@ function AnimatedCollapsible({
122121
>
123122
{({hovered}) => (
124123
<Icon
125-
src={isExpanded ? expensifyIcons.UpArrow : expensifyIcons.DownArrow}
124+
src={isExpanded ? Expensicons.UpArrow : Expensicons.DownArrow}
126125
fill={theme.icon}
127126
additionalStyles={!hovered && styles.opacitySemiTransparent}
128127
small

src/components/ApprovalWorkflowSection.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function ApprovalWorkflowSection({approvalWorkflow, onPress}: ApprovalWorkflowSe
2929
const theme = useTheme();
3030
const {translate, toLocaleOrdinal, localeCompare} = useLocalize();
3131
const {shouldUseNarrowLayout} = useResponsiveLayout();
32-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['ArrowRight'] as const);
3332

3433
const approverTitle = useCallback(
3534
(index: number) =>
@@ -108,7 +107,7 @@ function ApprovalWorkflowSection({approvalWorkflow, onPress}: ApprovalWorkflowSe
108107
))}
109108
</View>
110109
<Icon
111-
src={expensifyIcons.ArrowRight}
110+
src={Expensicons.ArrowRight}
112111
fill={theme.icon}
113112
additionalStyles={[styles.alignSelfCenter]}
114113
/>

src/components/Attachments/AttachmentCarousel/CarouselButtons.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import {View} from 'react-native';
33
import type {Attachment} from '@components/Attachments/types';
44
import Button from '@components/Button';
5+
import * as Expensicons from '@components/Icon/Expensicons';
56
import Tooltip from '@components/Tooltip';
6-
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
77
import useLocalize from '@hooks/useLocalize';
88
import useResponsiveLayout from '@hooks/useResponsiveLayout';
99
import useTheme from '@hooks/useTheme';
@@ -39,7 +39,6 @@ function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward
3939
const isForwardDisabled = page === attachments.length - 1;
4040
const {translate} = useLocalize();
4141
const {shouldUseNarrowLayout} = useResponsiveLayout();
42-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['ArrowRight', 'BackArrow'] as const);
4342

4443
return shouldShowArrows ? (
4544
<>
@@ -49,7 +48,7 @@ function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward
4948
<Button
5049
small
5150
innerStyles={[styles.arrowIcon]}
52-
icon={expensifyIcons.BackArrow}
51+
icon={Expensicons.BackArrow}
5352
iconFill={theme.text}
5453
onPress={onBack}
5554
onPressIn={cancelAutoHideArrow}
@@ -64,7 +63,7 @@ function CarouselButtons({page, attachments, shouldShowArrows, onBack, onForward
6463
<Button
6564
small
6665
innerStyles={[styles.arrowIcon]}
67-
icon={expensifyIcons.ArrowRight}
66+
icon={Expensicons.ArrowRight}
6867
iconFill={theme.text}
6968
onPress={onForward}
7069
onPressIn={cancelAutoHideArrow}

src/components/Attachments/AttachmentView/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Button from '@components/Button';
99
import DistanceEReceipt from '@components/DistanceEReceipt';
1010
import EReceipt from '@components/EReceipt';
1111
import Icon from '@components/Icon';
12+
// eslint-disable-next-line no-restricted-imports
13+
import {ArrowCircleClockwise} from '@components/Icon/Expensicons';
1214
import PerDiemEReceipt from '@components/PerDiemEReceipt';
1315
import ScrollView from '@components/ScrollView';
1416
import Text from '@components/Text';
@@ -131,7 +133,7 @@ function AttachmentView({
131133
reportID,
132134
transaction: transactionProp,
133135
}: AttachmentViewProps) {
134-
const icons = useMemoizedLazyExpensifyIcons(['ArrowCircleClockwise', 'Gallery'] as const);
136+
const icons = useMemoizedLazyExpensifyIcons(['Gallery'] as const);
135137
const [transactionFromOnyx] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionID)}`, {canBeMissing: true});
136138
const transaction = transactionProp ?? transactionFromOnyx;
137139
const {translate} = useLocalize();
@@ -292,7 +294,7 @@ function AttachmentView({
292294
</View>
293295
<Button
294296
text={translate('attachmentView.retry')}
295-
icon={icons.ArrowCircleClockwise}
297+
icon={ArrowCircleClockwise}
296298
onPress={() => {
297299
if (isOffline) {
298300
return;

src/components/Avatar.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, {useEffect, useState} from 'react';
22
import type {ImageStyle, StyleProp, ViewStyle} from 'react-native';
33
import {View} from 'react-native';
4-
import useDefaultAvatars from '@hooks/useDefaultAvatars';
54
import useNetwork from '@hooks/useNetwork';
65
import useStyleUtils from '@hooks/useStyleUtils';
76
import useTheme from '@hooks/useTheme';
@@ -14,6 +13,7 @@ import type {AvatarSizeName} from '@styles/utils';
1413
import CONST from '@src/CONST';
1514
import type {AvatarType} from '@src/types/onyx/OnyxCommon';
1615
import Icon from './Icon';
16+
import * as Expensicons from './Icon/Expensicons';
1717
import Image from './Image';
1818

1919
type AvatarProps = {
@@ -66,7 +66,7 @@ function Avatar({
6666
containerStyles,
6767
size = CONST.AVATAR_SIZE.DEFAULT,
6868
fill,
69-
fallbackIcon,
69+
fallbackIcon = Expensicons.FallbackAvatar,
7070
fallbackIconTestID = '',
7171
type,
7272
name = '',
@@ -77,7 +77,6 @@ function Avatar({
7777
const styles = useThemeStyles();
7878
const StyleUtils = useStyleUtils();
7979
const [imageError, setImageError] = useState(false);
80-
const defaultAvatars = useDefaultAvatars();
8180

8281
useNetwork({onReconnect: () => setImageError(false)});
8382

@@ -88,16 +87,15 @@ function Avatar({
8887
const isWorkspace = type === CONST.ICON_TYPE_WORKSPACE;
8988
const userAccountID = isWorkspace ? undefined : (avatarID as number);
9089

91-
const source = isWorkspace ? originalSource : getAvatar({avatarSource: originalSource, accountID: userAccountID, defaultAvatars});
90+
const source = isWorkspace ? originalSource : getAvatar({avatarSource: originalSource, accountID: userAccountID});
9291
let optimizedSource = source;
9392
const maybeDefaultAvatarName = getPresetAvatarNameFromURL(source);
9493

9594
if (maybeDefaultAvatarName) {
9695
optimizedSource = getAvatarLocal(maybeDefaultAvatarName);
9796
}
98-
const useFallBackAvatar = imageError || !source || source === defaultAvatars.FallbackAvatar;
99-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
100-
const fallbackAvatar = isWorkspace ? getDefaultWorkspaceAvatar(name) : fallbackIcon || defaultAvatars.FallbackAvatar;
97+
const useFallBackAvatar = imageError || !source || source === Expensicons.FallbackAvatar;
98+
const fallbackAvatar = isWorkspace ? getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar;
10199
const fallbackAvatarTestID = isWorkspace ? getDefaultWorkspaceAvatarTestID(name) : fallbackIconTestID || 'SvgFallbackAvatar Icon';
102100
const avatarSource = useFallBackAvatar ? fallbackAvatar : optimizedSource;
103101

@@ -110,7 +108,7 @@ function Avatar({
110108
if (isWorkspace) {
111109
iconColors = StyleUtils.getDefaultWorkspaceAvatarColor(avatarID?.toString() ?? '');
112110
// Assign the icon fill color only for the default fallback avatar
113-
} else if (useFallBackAvatar && avatarSource === defaultAvatars.FallbackAvatar) {
111+
} else if (useFallBackAvatar && avatarSource === Expensicons.FallbackAvatar) {
114112
iconColors = StyleUtils.getBackgroundColorAndFill(theme.buttonHoveredBG, theme.icon);
115113
} else {
116114
iconColors = null;

src/components/AvatarButtonWithIcon.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {RefObject} from 'react';
22
import React from 'react';
33
import {StyleSheet, View} from 'react-native';
44
import type {ImageStyle, StyleProp, ViewStyle} from 'react-native';
5-
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
65
import useTheme from '@hooks/useTheme';
76
import useThemeStyles from '@hooks/useThemeStyles';
87
import type {AvatarSource} from '@libs/UserAvatarUtils';
@@ -12,7 +11,6 @@ import type * as OnyxCommon from '@src/types/onyx/OnyxCommon';
1211
import type IconAsset from '@src/types/utils/IconAsset';
1312
import Avatar from './Avatar';
1413
import Icon from './Icon';
15-
// eslint-disable-next-line no-restricted-imports
1614
import * as Expensicons from './Icon/Expensicons';
1715
import OfflineWithFeedback from './OfflineWithFeedback';
1816
import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback';
@@ -80,7 +78,7 @@ function AvatarButtonWithIcon({
8078
onPress,
8179
source = '',
8280
avatarID,
83-
fallbackIcon,
81+
fallbackIcon = Expensicons.FallbackAvatar,
8482
size = CONST.AVATAR_SIZE.DEFAULT,
8583
type = CONST.ICON_TYPE_AVATAR,
8684
avatarStyle,
@@ -91,7 +89,6 @@ function AvatarButtonWithIcon({
9189
}: AvatarButtonWithIconProps) {
9290
const theme = useTheme();
9391
const styles = useThemeStyles();
94-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['FallbackAvatar'] as const);
9592

9693
return (
9794
<Tooltip
@@ -114,7 +111,7 @@ function AvatarButtonWithIcon({
114111
imageStyles={[styles.alignSelfCenter, avatarStyle]}
115112
source={source}
116113
avatarID={avatarID}
117-
fallbackIcon={fallbackIcon ?? expensifyIcons.FallbackAvatar}
114+
fallbackIcon={fallbackIcon}
118115
size={size}
119116
type={type}
120117
name={name}

src/components/AvatarWithImagePicker.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function AvatarWithImagePicker({
8989
onErrorClose = () => {},
9090
source = '',
9191
avatarID,
92-
fallbackIcon,
92+
fallbackIcon = Expensicons.FallbackAvatar,
9393
size = CONST.AVATAR_SIZE.DEFAULT,
9494
type = CONST.ICON_TYPE_AVATAR,
9595
isUsingDefaultAvatar = false,
@@ -118,7 +118,6 @@ function AvatarWithImagePicker({
118118
const {calculatePopoverPosition} = usePopoverPosition();
119119
const anchorRef = useRef<View>(null);
120120
const {translate} = useLocalize();
121-
const expensifyIcons = useMemoizedLazyExpensifyIcons(['FallbackAvatar'] as const);
122121

123122
const setError = (error: TranslationPaths | null, phraseParam: Record<string, unknown>) => {
124123
setErrorData({
@@ -264,7 +263,7 @@ function AvatarWithImagePicker({
264263
onPress={() => onPressAvatar(openPicker)}
265264
avatarStyle={avatarStyle}
266265
pendingAction={pendingAction}
267-
fallbackIcon={fallbackIcon ?? expensifyIcons.FallbackAvatar}
266+
fallbackIcon={fallbackIcon}
268267
anchorRef={anchorRef}
269268
DefaultAvatar={DefaultAvatar}
270269
editIcon={editIcon}

0 commit comments

Comments
 (0)