@@ -10,7 +10,6 @@ import ConfirmModal from '@components/ConfirmModal';
1010import DisplayNames from '@components/DisplayNames' ;
1111import HeaderWithBackButton from '@components/HeaderWithBackButton' ;
1212import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext' ;
13- import * as Expensicons from '@components/Icon/Expensicons' ;
1413import MenuItem from '@components/MenuItem' ;
1514import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription' ;
1615import OfflineWithFeedback from '@components/OfflineWithFeedback' ;
@@ -29,6 +28,7 @@ import useDeleteTransactions from '@hooks/useDeleteTransactions';
2928import useDuplicateTransactionsAndViolations from '@hooks/useDuplicateTransactionsAndViolations' ;
3029import useGetIOUReportFromReportAction from '@hooks/useGetIOUReportFromReportAction' ;
3130import useHasOutstandingChildTask from '@hooks/useHasOutstandingChildTask' ;
31+ import { useMemoizedLazyExpensifyIcons } from '@hooks/useLazyAsset' ;
3232import useLocalize from '@hooks/useLocalize' ;
3333import useNetwork from '@hooks/useNetwork' ;
3434import useOnyx from '@hooks/useOnyx' ;
@@ -47,6 +47,7 @@ import Parser from '@libs/Parser';
4747import Permissions from '@libs/Permissions' ;
4848import { isPolicyAdmin as isPolicyAdminUtil , isPolicyEmployee as isPolicyEmployeeUtil , shouldShowPolicy } from '@libs/PolicyUtils' ;
4949import { getOneTransactionThreadReportID , getOriginalMessage , getTrackExpenseActionableWhisper , isDeletedAction , isMoneyRequestAction , isTrackExpenseAction } from '@libs/ReportActionsUtils' ;
50+ import { getReportName as getReportNameFromReportNameUtils } from '@libs/ReportNameUtils' ;
5051import {
5152 canAddOrDeleteTransactions ,
5253 canDeleteCardTransactionByLiabilityType ,
@@ -65,7 +66,6 @@ import {
6566 getParticipantsList ,
6667 getReportDescription ,
6768 getReportFieldKey ,
68- getReportName ,
6969 isAdminOwnerApproverOrReportOwner ,
7070 isArchivedNonExpenseReport ,
7171 isCanceledTaskReport as isCanceledTaskReportUtil ,
@@ -155,6 +155,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
155155 const { isOffline} = useNetwork ( ) ;
156156 const { isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy ( ) ;
157157 const styles = useThemeStyles ( ) ;
158+ const expensifyIcons = useMemoizedLazyExpensifyIcons ( [ 'Users' , 'Gear' , 'Send' , 'Folder' , 'UserPlus' , 'Pencil' , 'Checkmark' , 'Building' , 'Exit' , 'Bug' , 'Camera' , 'Trashcan' ] as const ) ;
158159 const backTo = route . params . backTo ;
159160
160161 const [ parentReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . parentReportID } ` , { canBeMissing : true } ) ;
@@ -337,7 +338,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
337338 const shouldShowLeaveButton = canLeaveChat ( report , policy , ! ! reportNameValuePairs ?. private_isArchived ) ;
338339 const shouldShowGoToWorkspace = shouldShowPolicy ( policy , false , currentUserPersonalDetails ?. email ) && ! policy ?. isJoinRequestPending ;
339340
340- const reportName = Parser . htmlToText ( getReportName ( report , undefined , undefined , undefined , undefined , reportAttributes ) ) ;
341+ const reportName = Parser . htmlToText ( getReportNameFromReportNameUtils ( report , reportAttributes ) ) ;
341342 const additionalRoomDetails =
342343 ( isPolicyExpenseChat && ! ! report ?. isOwnPolicyExpenseChat ) || isExpenseReportUtil ( report ) || isPolicyExpenseChat || isInvoiceRoom
343344 ? chatRoomSubtitle
@@ -383,7 +384,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
383384 items . push ( {
384385 key : CONST . REPORT_DETAILS_MENU_ITEM . MEMBERS ,
385386 translationKey : 'common.members' ,
386- icon : Expensicons . Users ,
387+ icon : expensifyIcons . Users ,
387388 subtitle : activeChatMembers . length ,
388389 isAnonymousAction : false ,
389390 shouldShowRightIcon : true ,
@@ -399,7 +400,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
399400 items . push ( {
400401 key : CONST . REPORT_DETAILS_MENU_ITEM . INVITE ,
401402 translationKey : 'common.invite' ,
402- icon : Expensicons . Users ,
403+ icon : expensifyIcons . Users ,
403404 isAnonymousAction : false ,
404405 shouldShowRightIcon : true ,
405406 action : ( ) => {
@@ -412,7 +413,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
412413 items . push ( {
413414 key : CONST . REPORT_DETAILS_MENU_ITEM . SETTINGS ,
414415 translationKey : 'common.settings' ,
415- icon : Expensicons . Gear ,
416+ icon : expensifyIcons . Gear ,
416417 isAnonymousAction : false ,
417418 shouldShowRightIcon : true ,
418419 action : ( ) => {
@@ -428,7 +429,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
428429 items . push ( {
429430 key : CONST . REPORT_DETAILS_MENU_ITEM . TRACK . SUBMIT ,
430431 translationKey : 'actionableMentionTrackExpense.submit' ,
431- icon : Expensicons . Send ,
432+ icon : expensifyIcons . Send ,
432433 isAnonymousAction : false ,
433434 shouldShowRightIcon : true ,
434435 action : ( ) => {
@@ -447,7 +448,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
447448 items . push ( {
448449 key : CONST . REPORT_DETAILS_MENU_ITEM . TRACK . CATEGORIZE ,
449450 translationKey : 'actionableMentionTrackExpense.categorize' ,
450- icon : Expensicons . Folder ,
451+ icon : expensifyIcons . Folder ,
451452 isAnonymousAction : false ,
452453 shouldShowRightIcon : true ,
453454 action : ( ) => {
@@ -457,7 +458,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
457458 items . push ( {
458459 key : CONST . REPORT_DETAILS_MENU_ITEM . TRACK . SHARE ,
459460 translationKey : 'actionableMentionTrackExpense.share' ,
460- icon : Expensicons . UserPlus ,
461+ icon : expensifyIcons . UserPlus ,
461462 isAnonymousAction : false ,
462463 shouldShowRightIcon : true ,
463464 action : ( ) => {
@@ -472,7 +473,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
472473 items . push ( {
473474 key : CONST . REPORT_DETAILS_MENU_ITEM . PRIVATE_NOTES ,
474475 translationKey : 'privateNotes.title' ,
475- icon : Expensicons . Pencil ,
476+ icon : expensifyIcons . Pencil ,
476477 isAnonymousAction : false ,
477478 shouldShowRightIcon : true ,
478479 action : ( ) => navigateToPrivateNotes ( report , currentUserPersonalDetails . accountID , backTo ) ,
@@ -485,7 +486,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
485486 if ( isCompletedTaskReport ( report ) && isTaskActionable ) {
486487 items . push ( {
487488 key : CONST . REPORT_DETAILS_MENU_ITEM . MARK_AS_INCOMPLETE ,
488- icon : Expensicons . Checkmark ,
489+ icon : expensifyIcons . Checkmark ,
489490 translationKey : 'task.markAsIncomplete' ,
490491 isAnonymousAction : false ,
491492 action : callFunctionIfActionIsAllowed ( ( ) => {
@@ -500,7 +501,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
500501 items . push ( {
501502 key : CONST . REPORT_DETAILS_MENU_ITEM . GO_TO_WORKSPACE ,
502503 translationKey : 'workspace.common.goToWorkspace' ,
503- icon : Expensicons . Building ,
504+ icon : expensifyIcons . Building ,
504505 action : ( ) => {
505506 if ( ! report ?. policyID ) {
506507 return ;
@@ -520,7 +521,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
520521 items . push ( {
521522 key : CONST . REPORT_DETAILS_MENU_ITEM . LEAVE_ROOM ,
522523 translationKey : 'common.leave' ,
523- icon : Expensicons . Exit ,
524+ icon : expensifyIcons . Exit ,
524525 isAnonymousAction : true ,
525526 action : ( ) => {
526527 if ( getParticipantsAccountIDsForDisplay ( report , false , true ) . length === 1 && isRootGroupChat ) {
@@ -537,7 +538,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
537538 items . push ( {
538539 key : CONST . REPORT_DETAILS_MENU_ITEM . DEBUG ,
539540 translationKey : 'debug.debug' ,
540- icon : Expensicons . Bug ,
541+ icon : expensifyIcons . Bug ,
541542 action : ( ) => Navigation . navigate ( ROUTES . DEBUG_REPORT . getRoute ( report . reportID ) ) ,
542543 isAnonymousAction : true ,
543544 shouldShowRightIcon : true ,
@@ -641,7 +642,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
641642 updateGroupChatAvatar ( report . reportID ) ;
642643 } }
643644 onImageSelected = { ( file ) => updateGroupChatAvatar ( report . reportID , file ) }
644- editIcon = { Expensicons . Camera }
645+ editIcon = { expensifyIcons . Camera }
645646 editIconStyle = { styles . smallEditIconAccount }
646647 pendingAction = { report . pendingFields ?. avatar ?? undefined }
647648 errors = { report . errorFields ?. avatar ?? null }
@@ -743,7 +744,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
743744 const nameSectionGroupWorkspace = (
744745 < OfflineWithFeedback
745746 pendingAction = { report ?. pendingFields ?. reportName }
746- errors = { report ?. errorFields ?. reportName }
747+ errors = { report ?. errorFields ?. reportName ?? null }
747748 errorRowStyles = { [ styles . ph5 ] }
748749 onClose = { ( ) => clearPolicyRoomNameErrors ( report ?. reportID ) }
749750 >
@@ -790,7 +791,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
790791 const nameSectionTitleField = ! ! titleField && (
791792 < OfflineWithFeedback
792793 pendingAction = { report . pendingFields ?. reportName }
793- errors = { report . errorFields ?. reportName }
794+ errors = { report . errorFields ?. reportName ?? null }
794795 errorRowStyles = { styles . ph5 }
795796 key = { `menuItem-${ fieldKey } ` }
796797 onClose = { ( ) => clearPolicyRoomNameErrors ( report . reportID ) }
@@ -1004,7 +1005,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail
10041005 { shouldShowDeleteButton && (
10051006 < MenuItem
10061007 key = { CONST . REPORT_DETAILS_MENU_ITEM . DELETE }
1007- icon = { Expensicons . Trashcan }
1008+ icon = { expensifyIcons . Trashcan }
10081009 title = { caseID === CASES . DEFAULT ? translate ( 'common.delete' ) : translate ( 'reportActionContextMenu.deleteAction' , { action : requestParentReportAction } ) }
10091010 onPress = { ( ) => setIsDeleteModalVisible ( true ) }
10101011 />
0 commit comments