diff --git a/src/components/Breadcrumbs.tsx b/src/components/Breadcrumbs.tsx index 874184ddabed..d7f12f3f7ab6 100644 --- a/src/components/Breadcrumbs.tsx +++ b/src/components/Breadcrumbs.tsx @@ -1,7 +1,7 @@ import React from 'react'; import type {StyleProp, ViewStyle} from 'react-native'; import {PixelRatio, View} from 'react-native'; -import LogoComponent from '@assets/images/expensify-wordmark.svg'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; @@ -38,6 +38,8 @@ function Breadcrumbs({breadcrumbs, style}: BreadcrumbsProps) { const [primaryBreadcrumb, secondaryBreadcrumb] = breadcrumbs; const isRootBreadcrumb = primaryBreadcrumb.type === CONST.BREADCRUMB_TYPE.ROOT; const fontScale = PixelRatio.getFontScale() > CONST.LOGO_MAX_SCALE ? CONST.LOGO_MAX_SCALE : PixelRatio.getFontScale(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); + return ( {isRootBreadcrumb ? ( @@ -46,7 +48,7 @@ function Breadcrumbs({breadcrumbs, style}: BreadcrumbsProps) { title={ diff --git a/src/components/DistanceEReceipt.tsx b/src/components/DistanceEReceipt.tsx index 9a1463c2506f..296619da9247 100644 --- a/src/components/DistanceEReceipt.tsx +++ b/src/components/DistanceEReceipt.tsx @@ -1,6 +1,7 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; import EReceiptBackground from '@assets/images/eReceipt_background.svg'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import {convertToDisplayString} from '@libs/CurrencyUtils'; @@ -12,7 +13,6 @@ import type {TranslationPaths} from '@src/languages/types'; import type {Transaction} from '@src/types/onyx'; import type {WaypointCollection} from '@src/types/onyx/Transaction'; import Icon from './Icon'; -import * as Expensicons from './Icon/Expensicons'; import ImageSVG from './ImageSVG'; import PendingMapView from './MapView/PendingMapView'; import ReceiptImage from './ReceiptImage'; @@ -30,6 +30,7 @@ type DistanceEReceiptProps = { function DistanceEReceipt({transaction, hoverPreview = false}: DistanceEReceiptProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); const thumbnail = hasReceipt(transaction) ? getThumbnailAndImageURIs(transaction).thumbnail : null; const {amount: transactionAmount, currency: transactionCurrency, merchant: transactionMerchant, created: transactionDate} = getTransactionDetails(transaction) ?? {}; const formattedTransactionAmount = convertToDisplayString(transactionAmount, transactionCurrency); @@ -101,7 +102,7 @@ function DistanceEReceipt({transaction, hoverPreview = false}: DistanceEReceiptP {translate('eReceipt.guaranteed')} diff --git a/src/components/DistanceMapView/index.android.tsx b/src/components/DistanceMapView/index.android.tsx index 92fe87a762fa..0c97a643daf5 100644 --- a/src/components/DistanceMapView/index.android.tsx +++ b/src/components/DistanceMapView/index.android.tsx @@ -1,9 +1,9 @@ import React, {useState} from 'react'; import {View} from 'react-native'; import BlockingView from '@components/BlockingViews/BlockingView'; -import * as Expensicons from '@components/Icon/Expensicons'; import MapView from '@components/MapView'; import PendingMapView from '@components/MapView/PendingMapView'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useStyleUtils from '@hooks/useStyleUtils'; @@ -18,6 +18,7 @@ function DistanceMapView({overlayStyle, requireRouteToDisplayMap, ...rest}: Dist const {translate} = useLocalize(); const theme = useTheme(); const StyleUtils = useStyleUtils(); + const icons = useMemoizedLazyExpensifyIcons(['EmptyStateRoutePending'] as const); return ( <> @@ -36,7 +37,7 @@ function DistanceMapView({overlayStyle, requireRouteToDisplayMap, ...rest}: Dist {/* The "map pending" text should only be shown in the IOU create flow. In the created IOU preview, only the icon should be shown. */} {!requireRouteToDisplayMap ? ( {({isDraggingOver}) => ( {({isDraggingOver}) => ( @@ -157,7 +158,7 @@ function EReceipt({transactionID, transactionItem, onLoad, isThumbnail = false}: width={variables.eReceiptWordmarkWidth} height={variables.eReceiptWordmarkHeight} fill={secondaryColor} - src={Expensicons.ExpensifyWordmark} + src={icons.ExpensifyWordmark} /> diff --git a/src/components/Icon/Expensicons.ts b/src/components/Icon/Expensicons.ts index 1a885a21901c..f293d36252a4 100644 --- a/src/components/Icon/Expensicons.ts +++ b/src/components/Icon/Expensicons.ts @@ -71,18 +71,9 @@ import DragAndDrop from '@assets/images/drag-and-drop.svg'; import DragHandles from '@assets/images/drag-handles.svg'; import Emoji from '@assets/images/emoji.svg'; import Lightbulb from '@assets/images/emojiCategoryIcons/light-bulb.svg'; -import EmptyStateRoutePending from '@assets/images/emptystate__routepending.svg'; -import EmptyStateSpyPigeon from '@assets/images/emptystate__spy-pigeon.svg'; import EReceiptIcon from '@assets/images/eReceiptIcon.svg'; import Exclamation from '@assets/images/exclamation.svg'; -import Exit from '@assets/images/exit.svg'; import Expand from '@assets/images/expand.svg'; -import ExpensifyAppIcon from '@assets/images/expensify-app-icon.svg'; -import ExpensifyCard from '@assets/images/expensify-card-icon.svg'; -import ExpensifyFooterLogoVertical from '@assets/images/expensify-footer-logo-vertical.svg'; -import ExpensifyFooterLogo from '@assets/images/expensify-footer-logo.svg'; -import ExpensifyLogoNew from '@assets/images/expensify-logo-new.svg'; -import ExpensifyWordmark from '@assets/images/expensify-wordmark.svg'; import Export from '@assets/images/export.svg'; import EyeDisabled from '@assets/images/eye-disabled.svg'; import Eye from '@assets/images/eye.svg'; @@ -168,7 +159,6 @@ import Printer from '@assets/images/printer.svg'; import Profile from '@assets/images/profile.svg'; import QrCode from '@assets/images/qrcode.svg'; import QuestionMark from '@assets/images/question-mark-circle.svg'; -import ReceiptBody from '@assets/images/receipt-body.svg'; import ReceiptMultiple from '@assets/images/receipt-multiple.svg'; import ReceiptPlaceholderPlus from '@assets/images/receipt-placeholder-plus.svg'; import ReceiptPlus from '@assets/images/receipt-plus.svg'; @@ -181,12 +171,8 @@ import RotateLeft from '@assets/images/rotate-left.svg'; import Scan from '@assets/images/scan.svg'; import Send from '@assets/images/send.svg'; import Shield from '@assets/images/shield.svg'; -import AppleLogo from '@assets/images/signIn/apple-logo.svg'; -import GoogleLogo from '@assets/images/signIn/google-logo.svg'; import AdvancedApprovalsSquare from '@assets/images/simple-illustrations/advanced-approvals-icon-square.svg'; -import MessageInABottle from '@assets/images/simple-illustrations/simple-illustration__messageinabottle.svg'; import ReplaceReceipt from '@assets/images/simple-illustrations/simple-illustration__replace-receipt.svg'; -import SmartScan from '@assets/images/simple-illustrations/simple-illustration__smartscan.svg'; import Facebook from '@assets/images/social-facebook.svg'; import Instagram from '@assets/images/social-instagram.svg'; import Linkedin from '@assets/images/social-linkedin.svg'; @@ -207,7 +193,6 @@ import ThumbsUp from '@assets/images/thumbs-up.svg'; import Train from '@assets/images/train.svg'; import Transfer from '@assets/images/transfer.svg'; import Trashcan from '@assets/images/trashcan.svg'; -import TreasureChest from '@assets/images/treasure-chest.svg'; import Unlock from '@assets/images/unlock.svg'; import UploadAlt from '@assets/images/upload-alt.svg'; import Upload from '@assets/images/upload.svg'; @@ -227,13 +212,11 @@ import Clear from '@assets/images/x-circle.svg'; import Zoom from '@assets/images/zoom.svg'; export { - ReceiptBody, ActiveRoomAvatar, AddReaction, All, Android, Apple, - AppleLogo, ArrowSplit, ArrowCollapse, ArrowRight, @@ -285,14 +268,7 @@ export { DragHandles, EReceiptIcon, Emoji, - EmptyStateRoutePending, Exclamation, - Exit, - ExpensifyAppIcon, - ExpensifyCard, - ExpensifyWordmark, - ExpensifyFooterLogo, - ExpensifyFooterLogoVertical, Expand, Export, Eye, @@ -312,7 +288,6 @@ export { Gallery, Gear, Globe, - GoogleLogo, Hashtag, Heart, History, @@ -338,7 +313,6 @@ export { Menu, Meter, Megaphone, - MessageInABottle, MoneyBag, MoneyCircle, MoneySearch, @@ -346,7 +320,6 @@ export { MoneyHourglass, Monitor, Mute, - ExpensifyLogoNew, NewWindow, NewWorkspace, NotificationsAvatar, @@ -364,7 +337,6 @@ export { QBOSquare, QrCode, QuestionMark, - TreasureChest, Receipt, ReceiptPlaceholderPlus, ReceiptPlus, @@ -378,7 +350,6 @@ export { Scan, Send, Shield, - SmartScan, Stopwatch, Suitcase, Sync, @@ -447,7 +418,6 @@ export { Minus, ThumbsDown, UserLock, - EmptyStateSpyPigeon, NetSuiteExport, QBOExport, SageIntacctExport, diff --git a/src/components/Icon/Illustrations.ts b/src/components/Icon/Illustrations.ts index 05ebee1667ba..8f4d8d1cbfc5 100644 --- a/src/components/Icon/Illustrations.ts +++ b/src/components/Icon/Illustrations.ts @@ -86,7 +86,6 @@ import ThumbsDown from '@assets/images/simple-illustrations/simple-illustration_ import ThumbsUpStars from '@assets/images/simple-illustrations/simple-illustration__thumbsupstars.svg'; import Tire from '@assets/images/simple-illustrations/simple-illustration__tire.svg'; import TrashCan from '@assets/images/simple-illustrations/simple-illustration__trashcan.svg'; -import TreasureChest from '@assets/images/simple-illustrations/simple-illustration__treasurechest.svg'; import VirtualCard from '@assets/images/simple-illustrations/simple-illustration__virtualcard.svg'; import ExpensifyApprovedLogo from '@assets/images/subscription-details__approvedlogo.svg'; import TurtleInShell from '@assets/images/turtle-in-shell.svg'; @@ -110,7 +109,6 @@ export { Luggage, MoneyIntoWallet, ConciergeBubble, - TreasureChest, ThumbsUpStars, HeadSet, Hourglass, diff --git a/src/components/Icon/chunks/illustrations.chunk.ts b/src/components/Icon/chunks/illustrations.chunk.ts index 034186ecf994..7c7ef18ffd21 100644 --- a/src/components/Icon/chunks/illustrations.chunk.ts +++ b/src/components/Icon/chunks/illustrations.chunk.ts @@ -98,6 +98,7 @@ import ShieldYellow from '@assets/images/simple-illustrations/simple-illustratio import Stopwatch from '@assets/images/simple-illustrations/simple-illustration__stopwatch.svg'; import Tag from '@assets/images/simple-illustrations/simple-illustration__tag.svg'; import ThumbsDown from '@assets/images/simple-illustrations/simple-illustration__thumbsdown.svg'; +import TreasureChest from '@assets/images/simple-illustrations/simple-illustration__treasurechest.svg'; import CompanyCard from '@assets/images/simple-illustrations/simple-illustration__twocards-horizontal.svg'; import Workflows from '@assets/images/simple-illustrations/simple-illustration__workflows.svg'; import ExpensifyApprovedLogo from '@assets/images/subscription-details__approvedlogo.svg'; @@ -178,6 +179,7 @@ const Illustrations = { Tag, CompanyCard, ThumbsDown, + TreasureChest, Workflows, CarIce, BlueShield, diff --git a/src/components/MapView/PendingMapView.tsx b/src/components/MapView/PendingMapView.tsx index 73d8e7927912..9e1ae2568c40 100644 --- a/src/components/MapView/PendingMapView.tsx +++ b/src/components/MapView/PendingMapView.tsx @@ -3,7 +3,7 @@ import React from 'react'; import {View} from 'react-native'; import BlockingView from '@components/BlockingViews/BlockingView'; import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; @@ -13,12 +13,13 @@ function PendingMapView({title = '', subtitle = '', style, isSmallerIcon = false const hasTextContent = !isEmpty(title) || !isEmpty(subtitle); const styles = useThemeStyles(); const theme = useTheme(); + const icons = useMemoizedLazyExpensifyIcons(['EmptyStateRoutePending'] as const); const iconSize = isSmallerIcon ? variables.iconSizeSuperLarge : variables.iconSizeUltraLarge; return ( {hasTextContent ? ( {translate('eReceipt.guaranteed')} diff --git a/src/components/QRShare/index.tsx b/src/components/QRShare/index.tsx index 40f71bc804ea..66557d9d9047 100644 --- a/src/components/QRShare/index.tsx +++ b/src/components/QRShare/index.tsx @@ -2,10 +2,10 @@ import React, {useImperativeHandle, useRef, useState} from 'react'; import type {LayoutChangeEvent} from 'react-native'; import {View} from 'react-native'; import type {Svg} from 'react-native-svg'; -import ExpensifyWordmark from '@assets/images/expensify-wordmark.svg'; import ImageSVG from '@components/ImageSVG'; import QRCode from '@components/QRCode'; import Text from '@components/Text'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; @@ -34,6 +34,7 @@ function QRShare({ const {shouldUseNarrowLayout} = useResponsiveLayout(); const {windowWidth} = useWindowDimensions(); const qrCodeContainerWidth = shouldUseNarrowLayout ? windowWidth : variables.sideBarWidth; + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); const {formatPhoneNumber} = useLocalize(); @@ -62,7 +63,7 @@ function QRShare({ diff --git a/src/components/SAMLLoadingIndicator.tsx b/src/components/SAMLLoadingIndicator.tsx index 2de503985e7d..d5e692c6c0c2 100644 --- a/src/components/SAMLLoadingIndicator.tsx +++ b/src/components/SAMLLoadingIndicator.tsx @@ -1,13 +1,11 @@ import React from 'react'; import {StyleSheet, View} from 'react-native'; -import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; +import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import variables from '@styles/variables'; import Icon from './Icon'; -// eslint-disable-next-line no-restricted-imports -import * as Expensicons from './Icon/Expensicons'; import Text from './Text'; function SAMLLoadingIndicator() { @@ -15,6 +13,7 @@ function SAMLLoadingIndicator() { const styles = useThemeStyles(); const illustrations = useMemoizedLazyIllustrations(['RocketBlue'] as const); const {translate} = useLocalize(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); return ( @@ -40,7 +39,7 @@ function SAMLLoadingIndicator() { width={154} height={34} fill={theme.success} - src={Expensicons.ExpensifyWordmark} + src={icons.ExpensifyWordmark} /> diff --git a/src/components/SignInButtons/IconButton.tsx b/src/components/SignInButtons/IconButton.tsx index 7ef476cff18a..796d86905a63 100644 --- a/src/components/SignInButtons/IconButton.tsx +++ b/src/components/SignInButtons/IconButton.tsx @@ -1,31 +1,14 @@ -import React from 'react'; +import React, {useMemo} from 'react'; import type {ValueOf} from 'type-fest'; import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import type IconAsset from '@src/types/utils/IconAsset'; -const providerData = { - [CONST.SIGN_IN_METHOD.APPLE]: { - icon: Expensicons.AppleLogo, - accessibilityLabel: 'common.signInWithApple', - }, - [CONST.SIGN_IN_METHOD.GOOGLE]: { - icon: Expensicons.GoogleLogo, - accessibilityLabel: 'common.signInWithGoogle', - }, -} satisfies Record< - ValueOf, - { - icon: IconAsset; - accessibilityLabel: TranslationPaths; - } ->; - type IconButtonProps = { onPress?: () => void; provider: ValueOf; @@ -34,6 +17,29 @@ type IconButtonProps = { function IconButton({onPress = () => {}, provider}: IconButtonProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); + const icons = useMemoizedLazyExpensifyIcons(['AppleLogo', 'GoogleLogo'] as const); + + const providerData = useMemo( + () => + ({ + [CONST.SIGN_IN_METHOD.APPLE]: { + icon: icons.AppleLogo, + accessibilityLabel: 'common.signInWithApple' as const, + }, + [CONST.SIGN_IN_METHOD.GOOGLE]: { + icon: icons.GoogleLogo, + accessibilityLabel: 'common.signInWithGoogle' as const, + }, + }) satisfies Record< + ValueOf, + { + icon: IconAsset; + accessibilityLabel: TranslationPaths; + } + >, + [icons.AppleLogo, icons.GoogleLogo], + ); + return ( @@ -56,7 +55,7 @@ function ExpiredValidateCodeModal() { width={variables.modalWordmarkWidth} height={variables.modalWordmarkHeight} fill={theme.success} - src={Expensicons.ExpensifyWordmark} + src={icons.ExpensifyWordmark} /> diff --git a/src/components/ValidateCode/JustSignedInModal.tsx b/src/components/ValidateCode/JustSignedInModal.tsx index 527493c778cb..a57c6f750572 100644 --- a/src/components/ValidateCode/JustSignedInModal.tsx +++ b/src/components/ValidateCode/JustSignedInModal.tsx @@ -1,10 +1,10 @@ import React from 'react'; import {View} from 'react-native'; import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; import Lottie from '@components/Lottie'; import LottieAnimations from '@components/LottieAnimations'; import Text from '@components/Text'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -19,6 +19,7 @@ function JustSignedInModal({is2FARequired}: JustSignedInModalProps) { const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); return ( @@ -43,7 +44,7 @@ function JustSignedInModal({is2FARequired}: JustSignedInModalProps) { width={variables.modalWordmarkWidth} height={variables.modalWordmarkHeight} fill={theme.success} - src={Expensicons.ExpensifyWordmark} + src={icons.ExpensifyWordmark} /> diff --git a/src/pages/ConnectionCompletePage.tsx b/src/pages/ConnectionCompletePage.tsx index f41fa1dc3686..9e172037c2d2 100644 --- a/src/pages/ConnectionCompletePage.tsx +++ b/src/pages/ConnectionCompletePage.tsx @@ -1,8 +1,10 @@ import React from 'react'; import {View} from 'react-native'; import Icon from '@components/Icon'; +// eslint-disable-next-line no-restricted-imports import * as Expensicons from '@components/Icon/Expensicons'; import Text from '@components/Text'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -12,6 +14,7 @@ function ConnectionCompletePage() { const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark'] as const); return ( @@ -32,7 +35,7 @@ function ConnectionCompletePage() { width={variables.modalWordmarkWidth} height={variables.modalWordmarkHeight} fill={theme.success} - src={Expensicons.ExpensifyWordmark} + src={icons.ExpensifyWordmark} /> diff --git a/src/pages/ErrorPage/GenericErrorPage.tsx b/src/pages/ErrorPage/GenericErrorPage.tsx index b9366174d652..cc246babe4ab 100644 --- a/src/pages/ErrorPage/GenericErrorPage.tsx +++ b/src/pages/ErrorPage/GenericErrorPage.tsx @@ -1,14 +1,13 @@ import React from 'react'; import {View} from 'react-native'; -import LogoWordmark from '@assets/images/expensify-wordmark.svg'; import Button from '@components/Button'; import Icon from '@components/Icon'; -import * as Expensicons from '@components/Icon/Expensicons'; import ImageSVG from '@components/ImageSVG'; import SafeAreaConsumer from '@components/SafeAreaConsumer'; import Text from '@components/Text'; import TextLink from '@components/TextLink'; import useIsAuthenticated from '@hooks/useIsAuthenticated'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import usePageRefresh from '@hooks/usePageRefresh'; import useStyleUtils from '@hooks/useStyleUtils'; @@ -27,6 +26,7 @@ function GenericErrorPage({error}: {error?: Error}) { const {translate} = useLocalize(); const isChunkLoadError = error?.name === CONST.CHUNK_LOAD_ERROR || /Loading chunk [\d]+ failed/.test(error?.message ?? ''); const refreshPage = usePageRefresh(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyWordmark', 'Bug'] as const); return ( @@ -36,7 +36,7 @@ function GenericErrorPage({error}: {error?: Error}) { diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 2b762a69bd05..3f852d22a85f 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -12,8 +12,6 @@ import DropZoneUI from '@components/DropZone/DropZoneUI'; import DualDropZone from '@components/DropZone/DualDropZone'; import EmojiPickerButton from '@components/EmojiPicker/EmojiPickerButton'; import ExceededCommentLength from '@components/ExceededCommentLength'; -// eslint-disable-next-line no-restricted-imports -import * as Expensicons from '@components/Icon/Expensicons'; import ImportedStateIndicator from '@components/ImportedStateIndicator'; import type {Mention} from '@components/MentionSuggestions'; import OfflineIndicator from '@components/OfflineIndicator'; @@ -24,6 +22,7 @@ import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' import useHandleExceedMaxCommentLength from '@hooks/useHandleExceedMaxCommentLength'; import useHandleExceedMaxTaskTitleLength from '@hooks/useHandleExceedMaxTaskTitleLength'; import useIsScrollLikelyLayoutTriggered from '@hooks/useIsScrollLikelyLayoutTriggered'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useOnyx from '@hooks/useOnyx'; @@ -184,6 +183,8 @@ function ReportActionCompose({ const {hasExceededMaxTaskTitleLength, validateTaskTitleMaxLength, setHasExceededMaxTitleLength} = useHandleExceedMaxTaskTitleLength(); const [exceededMaxLength, setExceededMaxLength] = useState(null); + const icons = useMemoizedLazyExpensifyIcons(['MessageInABottle'] as const); + const suggestionsRef = useRef(null); const composerRef = useRef(undefined); const reportParticipantIDs = useMemo( @@ -577,7 +578,7 @@ function ReportActionCompose({ {!shouldDisplayDualDropZone && ( validateAttachments({dragEvent})}> ; sectionTranslationKey: TranslationPaths; items: MenuData[]}; function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPageProps) { - const icons = useMemoizedLazyExpensifyIcons(['Gear', 'Profile', 'NewWindow'] as const); + const icons = useMemoizedLazyExpensifyIcons(['Gear', 'Profile', 'NewWindow', 'ExpensifyLogoNew', 'TreasureChest', 'Exit'] as const); const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: true}); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST, {canBeMissing: true}); const [fundList] = useOnyx(ONYXKEYS.FUND_LIST, {canBeMissing: true}); @@ -264,7 +264,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr return { translationKey: 'exitSurvey.goToExpensifyClassic', - icon: Expensicons.ExpensifyLogoNew, + icon: icons.ExpensifyLogoNew, ...(CONFIG.IS_HYBRID_APP ? { action: () => closeReactNativeApp({shouldSetNVP: true}), @@ -286,7 +286,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr }, }), }; - }, [tryNewDot?.classicRedirect?.isLockedToNewDot, tryNewDot?.classicRedirect?.dismissed, surveyCompletedWithinLastMonth]); + }, [tryNewDot?.classicRedirect?.isLockedToNewDot, tryNewDot?.classicRedirect?.dismissed, icons.ExpensifyLogoNew, surveyCompletedWithinLastMonth]); /** * Return a list of menu items data for general section @@ -313,7 +313,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr }, { translationKey: 'initialSettingsPage.whatIsNew', - icon: Expensicons.TreasureChest, + icon: icons.TreasureChest, iconRight: icons.NewWindow, shouldShowRightIcon: true, link: CONST.WHATS_NEW_URL, @@ -341,14 +341,14 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr }, { translationKey: signOutTranslationKey, - icon: Expensicons.Exit, + icon: icons.Exit, action: () => { signOut(false); }, }, ], }; - }, [icons.NewWindow, styles.pt4, classicRedirectMenuItem, tryNewDot?.nudgeMigration, signOut]); + }, [styles.pt4, classicRedirectMenuItem, tryNewDot?.nudgeMigration, icons.TreasureChest, icons.Exit, icons.NewWindow, signOut]); /** * Return JSX.Element with menu items diff --git a/src/pages/settings/Security/LockAccount/UnlockAccountPage.tsx b/src/pages/settings/Security/LockAccount/UnlockAccountPage.tsx index bfc0b9ad6dc0..d871a9b514ce 100644 --- a/src/pages/settings/Security/LockAccount/UnlockAccountPage.tsx +++ b/src/pages/settings/Security/LockAccount/UnlockAccountPage.tsx @@ -1,9 +1,9 @@ import React from 'react'; import ConfirmationPage from '@components/ConfirmationPage'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import * as Expensicons from '@components/Icon/Expensicons'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; @@ -13,6 +13,7 @@ import ROUTES from '@src/ROUTES'; function UnlockAccountPage() { const {translate} = useLocalize(); const styles = useThemeStyles(); + const icons = useMemoizedLazyExpensifyIcons(['EmptyStateSpyPigeon'] as const); return ( ); diff --git a/src/pages/settings/Subscription/CardSection/BillingBanner/PreTrialBillingBanner.tsx b/src/pages/settings/Subscription/CardSection/BillingBanner/PreTrialBillingBanner.tsx index bb3b5bcbdfd6..c13652712a48 100644 --- a/src/pages/settings/Subscription/CardSection/BillingBanner/PreTrialBillingBanner.tsx +++ b/src/pages/settings/Subscription/CardSection/BillingBanner/PreTrialBillingBanner.tsx @@ -1,24 +1,25 @@ import React from 'react'; -import * as Illustrations from '@components/Icon/Illustrations'; import Text from '@components/Text'; import TextLink from '@components/TextLink'; +import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as Report from '@libs/actions/Report'; +import {navigateToConciergeChat} from '@libs/actions/Report'; import Navigation from '@libs/Navigation/Navigation'; -import * as ReportUtils from '@libs/ReportUtils'; +import {getChatUsedForOnboarding} from '@libs/ReportUtils'; import ROUTES from '@src/ROUTES'; import BillingBanner from './BillingBanner'; function PreTrialBillingBanner() { const {translate} = useLocalize(); const styles = useThemeStyles(); + const illustrations = useMemoizedLazyIllustrations(['TreasureChest'] as const); const navigateToChat = () => { - const reportUsedForOnboarding = ReportUtils.getChatUsedForOnboarding(); + const reportUsedForOnboarding = getChatUsedForOnboarding(); if (!reportUsedForOnboarding) { - Report.navigateToConciergeChat(); + navigateToConciergeChat(); return; } @@ -40,7 +41,7 @@ function PreTrialBillingBanner() { {translate('subscription.billingBanner.preTrial.subtitleEnd')} } - icon={Illustrations.TreasureChest} + icon={illustrations.TreasureChest} /> ); } diff --git a/src/pages/settings/Subscription/CardSection/BillingBanner/TrialStartedBillingBanner.tsx b/src/pages/settings/Subscription/CardSection/BillingBanner/TrialStartedBillingBanner.tsx index 6de323091743..5a98a60bbdfd 100644 --- a/src/pages/settings/Subscription/CardSection/BillingBanner/TrialStartedBillingBanner.tsx +++ b/src/pages/settings/Subscription/CardSection/BillingBanner/TrialStartedBillingBanner.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import * as Illustrations from '@components/Icon/Illustrations'; +import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import {calculateRemainingFreeTrialDays, doesUserHavePaymentCardAdded} from '@libs/SubscriptionUtils'; @@ -10,13 +10,14 @@ function TrialStartedBillingBanner() { const {translate} = useLocalize(); const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID, {canBeMissing: true}); const [lastDayFreeTrial] = useOnyx(ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL, {canBeMissing: true}); + const illustrations = useMemoizedLazyIllustrations(['TreasureChest'] as const); const subtitle = !doesUserHavePaymentCardAdded(userBillingFundID) ? translate('subscription.billingBanner.trialStarted.subtitle') : ''; return ( ); } diff --git a/src/pages/settings/Troubleshoot/TroubleshootPage.tsx b/src/pages/settings/Troubleshoot/TroubleshootPage.tsx index a779122485df..15372095a16b 100644 --- a/src/pages/settings/Troubleshoot/TroubleshootPage.tsx +++ b/src/pages/settings/Troubleshoot/TroubleshootPage.tsx @@ -47,7 +47,7 @@ type BaseMenuItem = { }; function TroubleshootPage() { - const icons = useMemoizedLazyExpensifyIcons(['Download'] as const); + const icons = useMemoizedLazyExpensifyIcons(['Download', 'ExpensifyLogoNew'] as const); const illustrations = useMemoizedLazyIllustrations(['Lightbulb'] as const); const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -85,7 +85,7 @@ function TroubleshootPage() { return { translationKey: 'exitSurvey.goToExpensifyClassic', - icon: Expensicons.ExpensifyLogoNew, + icon: icons.ExpensifyLogoNew, ...(CONFIG.IS_HYBRID_APP ? { action: () => closeReactNativeApp({shouldSetNVP: true}), @@ -107,7 +107,7 @@ function TroubleshootPage() { }, }), }; - }, [tryNewDot?.classicRedirect?.isLockedToNewDot, surveyCompletedWithinLastMonth, shouldOpenSurveyReasonPage]); + }, [tryNewDot?.classicRedirect?.isLockedToNewDot, icons.ExpensifyLogoNew, surveyCompletedWithinLastMonth, shouldOpenSurveyReasonPage]); const menuItems = useMemo(() => { const debugConsoleItem: BaseMenuItem = { diff --git a/src/pages/signin/SignInPageLayout/Footer.tsx b/src/pages/signin/SignInPageLayout/Footer.tsx index c0ced49a3d23..c919a18641a3 100644 --- a/src/pages/signin/SignInPageLayout/Footer.tsx +++ b/src/pages/signin/SignInPageLayout/Footer.tsx @@ -3,11 +3,11 @@ import type {StyleProp, TextStyle} from 'react-native'; import {View} from 'react-native'; import SignInGradient from '@assets/images/home-fade-gradient--mobile.svg'; import Hoverable from '@components/Hoverable'; -import * as Expensicons from '@components/Icon/Expensicons'; import ImageSVG from '@components/ImageSVG'; import Text from '@components/Text'; import type {LinkProps, PressProps} from '@components/TextLink'; import TextLink from '@components/TextLink'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useStyleUtils from '@hooks/useStyleUtils'; @@ -148,6 +148,7 @@ function Footer({navigateFocus}: FooterProps) { const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); const {shouldUseNarrowLayout, isMediumScreenWidth} = useResponsiveLayout(); + const icons = useMemoizedLazyExpensifyIcons(['ExpensifyFooterLogo', 'ExpensifyFooterLogoVertical'] as const); const isVertical = shouldUseNarrowLayout; const imageDirection = isVertical ? styles.flexRow : styles.flexColumn; const imageStyle = isVertical ? styles.pr0 : styles.alignSelfCenter; @@ -216,10 +217,10 @@ function Footer({navigateFocus}: FooterProps) { {!isVertical ? ( - + ) : ( diff --git a/src/pages/workspace/WorkspaceOverviewPage.tsx b/src/pages/workspace/WorkspaceOverviewPage.tsx index 55fc36fa9e36..f942ca4009ab 100644 --- a/src/pages/workspace/WorkspaceOverviewPage.tsx +++ b/src/pages/workspace/WorkspaceOverviewPage.tsx @@ -9,7 +9,6 @@ import AvatarWithImagePicker from '@components/AvatarWithImagePicker'; import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu'; import type {DropdownOption} from '@components/ButtonWithDropdownMenu/types'; import ConfirmModal from '@components/ConfirmModal'; -import * as Expensicons from '@components/Icon/Expensicons'; import {LockedAccountContext} from '@components/LockedAccountModalProvider'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import OfflineWithFeedback from '@components/OfflineWithFeedback'; @@ -74,7 +73,7 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa const currentUserPersonalDetails = useCurrentUserPersonalDetails(); const illustrations = useThemeIllustrations(); const illustrationIcons = useMemoizedLazyIllustrations(['Building'] as const); - const expensifyIcons = useMemoizedLazyExpensifyIcons(['FallbackWorkspaceAvatar', 'ImageCropSquareMask', 'QrCode', 'Transfer', 'Trashcan', 'UserPlus'] as const); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['Exit', 'FallbackWorkspaceAvatar', 'ImageCropSquareMask', 'QrCode', 'Transfer', 'Trashcan', 'UserPlus'] as const); const backTo = route.params.backTo; const [currencyList = getEmptyObject()] = useOnyx(ONYXKEYS.CURRENCY_LIST, {canBeMissing: true}); @@ -404,7 +403,7 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa secondaryActions.push({ value: 'leave', text: translate('common.leave'), - icon: Expensicons.Exit, + icon: expensifyIcons.Exit, onSelected: () => close(handleLeave), }); return renderDropdownMenu(secondaryActions); @@ -458,7 +457,7 @@ function WorkspaceOverviewPage({policyDraft, policy: policyProp, route}: Workspa secondaryActions.push({ value: 'leave', text: translate('common.leave'), - icon: Expensicons.Exit, + icon: expensifyIcons.Exit, onSelected: () => close(handleLeave), }); } diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index dc8953b2b899..a911725c11ab 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -124,7 +124,7 @@ function isUserReimburserForPolicy(policies: Record { close(() => { @@ -484,6 +484,7 @@ function WorkspacesListPage() { isRestrictedToPreferredPolicy, policyIDToDelete, preferredPolicyID, + icons.Exit, ], ); diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index e3bf34c80eb7..f9f73bb26cec 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -92,7 +92,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { const policyID = policy?.id; const allCardSettings = useExpensifyCardFeeds(policyID); const isSyncInProgress = isConnectionInProgress(connectionSyncProgress, policy); - const icons = useMemoizedLazyExpensifyIcons(['Gear', 'NewWindow'] as const); + const icons = useMemoizedLazyExpensifyIcons(['Gear', 'NewWindow', 'ExpensifyCard'] as const); const illustrations = useMemoizedLazyIllustrations(['Accounting'] as const); const connectionNames = CONST.POLICY.CONNECTIONS.NAME; @@ -351,7 +351,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { ...(shouldShowCardReconciliationOption ? [ { - icon: Expensicons.ExpensifyCard, + icon: icons.ExpensifyCard, iconRight: Expensicons.ArrowRight, shouldShowRightIcon: true, title: translate('workspace.accounting.cardReconciliation'), @@ -423,6 +423,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { startIntegrationFlow, popoverAnchorRefs, datetimeToRelative, + icons.ExpensifyCard, ]); const otherIntegrationsItems = useMemo(() => { diff --git a/src/stories/PromotedActionBar.stories.tsx b/src/stories/PromotedActionBar.stories.tsx index 2dd81d8b5945..f505c68a5a54 100644 --- a/src/stories/PromotedActionBar.stories.tsx +++ b/src/stories/PromotedActionBar.stories.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import * as Expensicons from '@components/Icon/Expensicons'; +import {getExpensifyIcon} from '@components/Icon/chunks/expensify-icons.chunk'; import PromotedActionsBar from '@components/PromotedActionsBar'; import type {PromotedAction, PromotedActionsBarProps} from '@components/PromotedActionsBar'; import variables from '@src/styles/variables'; @@ -33,19 +33,19 @@ function Template(args: PromotedActionsBarProps) { const promotedActions = [ { key: 'join', - icon: Expensicons.CommentBubbles, + icon: getExpensifyIcon('CommentBubbles'), text: 'Join', onSelected: () => {}, }, { key: 'pin', - icon: Expensicons.Pin, + icon: getExpensifyIcon('Pin'), text: 'Pin', onSelected: () => {}, }, { key: 'share', - icon: Expensicons.QrCode, + icon: getExpensifyIcon('QrCode'), text: 'Share', onSelected: () => {}, }, @@ -53,7 +53,7 @@ const promotedActions = [ const defaultPromotedAction = { key: '', - icon: Expensicons.ExpensifyLogoNew, + icon: getExpensifyIcon('ExpensifyLogoNew'), text: '', onSelected: () => {}, };