@@ -51,7 +51,6 @@ import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/crea
5151import Navigation , { navigationRef } from '@libs/Navigation/Navigation' ;
5252import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
5353import type { ReportDetailsNavigatorParamList , RightModalNavigatorParamList } from '@libs/Navigation/types' ;
54- import { getPersonalDetailsForAccountIDs } from '@libs/OptionsListUtils' ;
5554import Parser from '@libs/Parser' ;
5655import Permissions from '@libs/Permissions' ;
5756import { isPolicyAdmin as isPolicyAdminUtil , isPolicyEmployee as isPolicyEmployeeUtil , shouldShowPolicy } from '@libs/PolicyUtils' ;
@@ -68,7 +67,6 @@ import {
6867 createDraftTransactionAndNavigateToParticipantSelector ,
6968 getAvailableReportFields ,
7069 getChatRoomSubtitle ,
71- getDisplayNamesWithTooltips ,
7270 getIcons ,
7371 getOriginalReportID ,
7472 getParentNavigationSubtitle ,
@@ -109,7 +107,6 @@ import {
109107 navigateBackOnDeleteTransaction ,
110108 navigateToPrivateNotes ,
111109 shouldDisableRename as shouldDisableRenameUtil ,
112- shouldUseFullTitleToDisplay ,
113110} from '@libs/ReportUtils' ;
114111import StringUtils from '@libs/StringUtils' ;
115112import { isDemoTransaction } from '@libs/TransactionUtils' ;
@@ -163,7 +160,7 @@ const CASES = {
163160type CaseID = ValueOf < typeof CASES > ;
164161
165162function ReportDetailsPage ( { policy, report, route, reportMetadata, reportLoadingState} : ReportDetailsPageProps ) {
166- const { translate, localeCompare , formatPhoneNumber} = useLocalize ( ) ;
163+ const { translate, formatPhoneNumber} = useLocalize ( ) ;
167164 const { isOffline} = useNetwork ( ) ;
168165 const { isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy ( ) ;
169166 const activePolicy = useActivePolicy ( ) ;
@@ -206,7 +203,6 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
206203 const isPolicyAdmin = useMemo ( ( ) => isPolicyAdminUtil ( policy ) , [ policy ] ) ;
207204 const isPolicyEmployee = useMemo ( ( ) => isPolicyEmployeeUtil ( report ?. policyID , policy ) , [ report ?. policyID , policy ] ) ;
208205 const isPolicyExpenseChat = useMemo ( ( ) => isPolicyExpenseChatUtil ( report ) , [ report ] ) ;
209- const shouldUseFullTitle = useMemo ( ( ) => shouldUseFullTitleToDisplay ( report ) , [ report ] ) ;
210206 const isChatRoom = useMemo ( ( ) => isChatRoomUtil ( report ) , [ report ] ) ;
211207 const isUserCreatedPolicyRoom = useMemo ( ( ) => isUserCreatedPolicyRoomUtil ( report ) , [ report ] ) ;
212208 const isDefaultRoom = useMemo ( ( ) => isDefaultRoomUtil ( report ) , [ report ] ) ;
@@ -663,26 +659,11 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
663659 delegateEmail ,
664660 ] ) ;
665661
666- const displayNamesWithTooltips = useMemo ( ( ) => {
667- const hasMultipleParticipants = participants . length > 1 ;
668- return getDisplayNamesWithTooltips ( getPersonalDetailsForAccountIDs ( participants , personalDetails ) , hasMultipleParticipants , localeCompare , formatPhoneNumber ) ;
669- } , [ participants , personalDetails , localeCompare , formatPhoneNumber ] ) ;
670-
671662 const icons = useMemo (
672663 ( ) => getIcons ( report , formatPhoneNumber , personalDetails , null , '' , - 1 , policy , undefined , isReportArchived ) ,
673664 [ report , formatPhoneNumber , personalDetails , policy , isReportArchived ] ,
674665 ) ;
675666
676- const chatRoomSubtitleText = chatRoomSubtitle ? (
677- < DisplayNames
678- fullTitle = { chatRoomSubtitle }
679- tooltipEnabled
680- numberOfLines = { 1 }
681- textStyles = { [ styles . sidebarLinkText , styles . textLabelSupporting , styles . pre , styles . mt1 , styles . textAlignCenter ] }
682- shouldUseFullTitle
683- />
684- ) : null ;
685-
686667 const renderedAvatar = useMemo ( ( ) => {
687668 if ( isChatRoom && ! isThread ) {
688669 return (
@@ -769,64 +750,6 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
769750 return result ;
770751 } , [ canJoin , report , backTo , currentUserPersonalDetails . accountID ] ) ;
771752
772- const nameSectionExpenseIOU = (
773- < View style = { [ styles . reportDetailsRoomInfo , styles . mw100 ] } >
774- { shouldDisableRename && (
775- < >
776- < View style = { [ styles . alignSelfCenter , styles . w100 , styles . mt1 ] } >
777- < DisplayNames
778- fullTitle = { reportName }
779- displayNamesWithTooltips = { displayNamesWithTooltips }
780- shouldParseFullTitle = { ! isGroupChat }
781- tooltipEnabled
782- numberOfLines = { isChatRoom && ! isChatThread ? 0 : 1 }
783- textStyles = { [ styles . textHeadline , styles . textAlignCenter , isChatRoom && ! isChatThread ? undefined : styles . pre ] }
784- shouldUseFullTitle = { shouldUseFullTitle }
785- />
786- </ View >
787- { isPolicyAdmin ? (
788- < PressableWithoutFeedback
789- style = { [ styles . w100 ] }
790- disabled = { policy ?. pendingAction === CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE }
791- role = { CONST . ROLE . BUTTON }
792- accessibilityLabel = { chatRoomSubtitle }
793- accessible
794- sentryLabel = { CONST . SENTRY_LABEL . REPORT_DETAILS . WORKSPACE_LINK }
795- onPress = { ( ) => {
796- let policyID = report ?. policyID ;
797-
798- if ( ! policyID ) {
799- policyID = '' ;
800- }
801-
802- Navigation . navigate ( ROUTES . WORKSPACE_INITIAL . getRoute ( policyID ) ) ;
803- } }
804- >
805- { chatRoomSubtitleText }
806- </ PressableWithoutFeedback >
807- ) : (
808- chatRoomSubtitleText
809- ) }
810- </ >
811- ) }
812- { ! isEmptyObject ( parentNavigationSubtitleData ) && ( isMoneyRequestReport || isInvoiceReport || isMoneyRequest || isTaskReport ) && (
813- < View style = { [ styles . w100 , styles . mt1 , styles . alignItemsCenter ] } >
814- < View style = { styles . mw100 } >
815- < ParentNavigationSubtitle
816- parentNavigationSubtitleData = { parentNavigationSubtitleData }
817- reportID = { report ?. reportID }
818- parentReportID = { report ?. parentReportID }
819- parentReportActionID = { report ?. parentReportActionID }
820- pressableStyles = { [ styles . mt1 , styles . mw100 ] }
821- textStyles = { [ styles . textAlignCenter ] }
822- subtitleNumberOfLines = { 2 }
823- />
824- </ View >
825- </ View >
826- ) }
827- </ View >
828- ) ;
829-
830753 const nameSectionGroupWorkspace = (
831754 < OfflineWithFeedback
832755 pendingAction = { report ?. pendingFields ?. reportName }
@@ -882,6 +805,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
882805 />
883806 }
884807 description = { translate ( 'threads.from' ) }
808+ descriptionTextStyle = { [ styles . mutedNormalTextLabel , styles . mb1 ] }
885809 shouldCheckActionAllowedOnPress = { false }
886810 />
887811 ) ;
@@ -896,21 +820,25 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
896820 >
897821 < View style = { [ styles . flex1 ] } >
898822 < MenuItemWithTopDescription
899- shouldShowRightIcon = { ! isFieldDisabled }
900- interactive = { ! isFieldDisabled }
823+ shouldShowRightIcon = { shouldShowEditableTitleField && ! isFieldDisabled }
824+ interactive = { shouldShowEditableTitleField && ! isFieldDisabled }
901825 title = { reportName }
902826 titleStyle = { styles . newKansasLarge }
903827 shouldCheckActionAllowedOnPress = { false }
904828 description = { translate ( 'task.title' ) }
905- onPress = { ( ) => {
906- let policyID = report . policyID ;
907-
908- if ( ! policyID ) {
909- policyID = '' ;
910- }
911-
912- Navigation . navigate ( ROUTES . EDIT_REPORT_FIELD_REQUEST . getRoute ( report . reportID , policyID , CONST . REPORT_FIELD_TITLE_FIELD_ID , backTo ) ) ;
913- } }
829+ onPress = {
830+ shouldShowEditableTitleField
831+ ? ( ) => {
832+ let policyID = report . policyID ;
833+
834+ if ( ! policyID ) {
835+ policyID = '' ;
836+ }
837+
838+ Navigation . navigate ( ROUTES . EDIT_REPORT_FIELD_REQUEST . getRoute ( report . reportID , policyID , CONST . REPORT_FIELD_TITLE_FIELD_ID , backTo ) ) ;
839+ }
840+ : undefined
841+ }
914842 />
915843 </ View >
916844 </ OfflineWithFeedback >
@@ -1079,6 +1007,9 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
10791007
10801008 const mentionReportContextValue = useMemo ( ( ) => ( { currentReportID : report . reportID , exactlyMatch : true } ) , [ report . reportID ] ) ;
10811009
1010+ const shouldShowFurtherDetailsContent =
1011+ shouldShowEditableTitleField || ( ! isEmptyObject ( parentNavigationSubtitleData ) && ( isMoneyRequestReport || isInvoiceReport || isMoneyRequest || isTaskReport ) ) ;
1012+
10821013 return (
10831014 < ScreenWrapper testID = "ReportDetailsPage" >
10841015 < FullPageNotFoundView shouldShow = { isEmptyObject ( report ) } >
@@ -1087,16 +1018,9 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
10871018 onBackButtonPress = { ( ) => Navigation . goBack ( backTo ) }
10881019 />
10891020 < ScrollView contentContainerStyle = { [ styles . flexGrow1 ] } >
1090- < View style = { [ styles . reportDetailsTitleContainer , styles . pb0 ] } >
1091- { renderedAvatar }
1092- { isExpenseReport && ! shouldShowEditableTitleField && nameSectionExpenseIOU }
1093- </ View >
1094- { isExpenseReport && shouldShowEditableTitleField && (
1095- < >
1096- { nameSectionTitleField }
1097- { nameSectionFurtherDetailsContent }
1098- </ >
1099- ) }
1021+ < View style = { [ styles . reportDetailsTitleContainer , styles . pb0 ] } > { renderedAvatar } </ View >
1022+ { isExpenseReport && nameSectionTitleField }
1023+ { isExpenseReport && shouldShowFurtherDetailsContent && nameSectionFurtherDetailsContent }
11001024
11011025 { ! isExpenseReport && nameSectionGroupWorkspace }
11021026
0 commit comments