@@ -6,16 +6,30 @@ import useLocalize from '@hooks/useLocalize';
6
6
import usePermissions from '@hooks/usePermissions' ;
7
7
import useThemeStyles from '@hooks/useThemeStyles' ;
8
8
import Navigation from '@libs/Navigation/Navigation' ;
9
- import * as OptionsListUtils from '@libs/OptionsListUtils' ;
9
+ import { getPersonalDetailsForAccountIDs } from '@libs/OptionsListUtils' ;
10
10
import { getPolicy } from '@libs/PolicyUtils' ;
11
- import * as ReportUtils from '@libs/ReportUtils' ;
11
+ import {
12
+ getDisplayNameForParticipant ,
13
+ getDisplayNamesWithTooltips ,
14
+ getParticipantsAccountIDsForDisplay ,
15
+ getPolicyName ,
16
+ getReportName ,
17
+ isArchivedNonExpenseReport ,
18
+ isChatRoom as isChatRoomReportUtils ,
19
+ isConciergeChatReport ,
20
+ isInvoiceRoom as isInvoiceRoomReportUtils ,
21
+ isOptimisticPersonalDetail ,
22
+ isPolicyExpenseChat as isPolicyExpenseChatReportUtils ,
23
+ isSelfDM as isSelfDMReportUtils ,
24
+ isSystemChat as isSystemChatReportUtils ,
25
+ temporary_getMoneyRequestOptions ,
26
+ } from '@libs/ReportUtils' ;
12
27
import SidebarUtils from '@libs/SidebarUtils' ;
13
28
import CONST from '@src/CONST' ;
14
29
import type { IOUType } from '@src/CONST' ;
15
30
import ONYXKEYS from '@src/ONYXKEYS' ;
16
31
import ROUTES from '@src/ROUTES' ;
17
32
import type { Policy , Report } from '@src/types/onyx' ;
18
- import { PressableWithoutFeedback } from './Pressable' ;
19
33
import RenderHTML from './RenderHTML' ;
20
34
import Text from './Text' ;
21
35
import UserDetailsTooltip from './UserDetailsTooltip' ;
@@ -32,21 +46,20 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
32
46
const { translate} = useLocalize ( ) ;
33
47
const styles = useThemeStyles ( ) ;
34
48
const [ personalDetails ] = useOnyx ( ONYXKEYS . PERSONAL_DETAILS_LIST ) ;
35
- const isPolicyExpenseChat = ReportUtils . isPolicyExpenseChat ( report ) ;
49
+ const isPolicyExpenseChat = isPolicyExpenseChatReportUtils ( report ) ;
36
50
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
37
51
const [ reportNameValuePairs ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ report ?. reportID || undefined } ` ) ;
38
- const isArchivedRoom = ReportUtils . isArchivedNonExpenseReport ( report , reportNameValuePairs ) ;
39
- const isChatRoom = ReportUtils . isChatRoom ( report ) ;
40
- const isSelfDM = ReportUtils . isSelfDM ( report ) ;
41
- const isInvoiceRoom = ReportUtils . isInvoiceRoom ( report ) ;
42
- const isSystemChat = ReportUtils . isSystemChat ( report ) ;
52
+ const isArchivedRoom = isArchivedNonExpenseReport ( report , reportNameValuePairs ) ;
53
+ const isChatRoom = isChatRoomReportUtils ( report ) ;
54
+ const isSelfDM = isSelfDMReportUtils ( report ) ;
55
+ const isInvoiceRoom = isInvoiceRoomReportUtils ( report ) ;
56
+ const isSystemChat = isSystemChatReportUtils ( report ) ;
43
57
const isDefault = ! ( isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom || isSystemChat ) ;
44
- const participantAccountIDs = ReportUtils . getParticipantsAccountIDsForDisplay ( report , undefined , true , true ) ;
58
+ const participantAccountIDs = getParticipantsAccountIDsForDisplay ( report , undefined , true , true ) ;
45
59
const isMultipleParticipant = participantAccountIDs . length > 1 ;
46
- const displayNamesWithTooltips = ReportUtils . getDisplayNamesWithTooltips ( OptionsListUtils . getPersonalDetailsForAccountIDs ( participantAccountIDs , personalDetails ) , isMultipleParticipant ) ;
60
+ const displayNamesWithTooltips = getDisplayNamesWithTooltips ( getPersonalDetailsForAccountIDs ( participantAccountIDs , personalDetails ) , isMultipleParticipant ) ;
47
61
const welcomeMessage = SidebarUtils . getWelcomeMessage ( report , policy ) ;
48
- const moneyRequestOptions = ReportUtils . temporary_getMoneyRequestOptions ( report , policy , participantAccountIDs ) ;
49
- const canEditReportDescription = ReportUtils . canEditReportDescription ( report , policy ) ;
62
+ const moneyRequestOptions = temporary_getMoneyRequestOptions ( report , policy , participantAccountIDs ) ;
50
63
const { canUseCombinedTrackSubmit} = usePermissions ( ) ;
51
64
const filteredOptions = moneyRequestOptions . filter (
52
65
( item ) : item is Exclude < IOUType , typeof CONST . IOU . TYPE . REQUEST | typeof CONST . IOU . TYPE . SEND | typeof CONST . IOU . TYPE . CREATE | typeof CONST . IOU . TYPE . INVOICE > =>
@@ -60,8 +73,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
60
73
) } `,
61
74
)
62
75
. join ( ', ' ) ;
63
- const canEditPolicyDescription = ReportUtils . canEditPolicyDescription ( policy ) ;
64
- const reportName = ReportUtils . getReportName ( report ) ;
76
+ const reportName = getReportName ( report ) ;
65
77
const shouldShowUsePlusButtonText =
66
78
( moneyRequestOptions . includes ( CONST . IOU . TYPE . PAY ) ||
67
79
moneyRequestOptions . includes ( CONST . IOU . TYPE . SUBMIT ) ||
@@ -105,75 +117,45 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
105
117
< View style = { [ styles . mt3 , styles . mw100 ] } >
106
118
{ isPolicyExpenseChat &&
107
119
( welcomeMessage ?. messageHtml ? (
108
- < PressableWithoutFeedback
109
- onPress = { ( ) => {
110
- if ( ! canEditPolicyDescription ) {
111
- return ;
112
- }
113
- Navigation . navigate ( ROUTES . WORKSPACE_PROFILE_DESCRIPTION . getRoute ( policy ?. id ) ) ;
114
- } }
115
- style = { [ styles . renderHTML , canEditPolicyDescription ? styles . cursorPointer : styles . cursorText ] }
116
- accessibilityLabel = { translate ( 'reportDescriptionPage.roomDescription' ) }
117
- >
120
+ < View style = { [ styles . renderHTML , styles . cursorText ] } >
118
121
< RenderHTML html = { welcomeMessage . messageHtml } />
119
- </ PressableWithoutFeedback >
122
+ </ View >
120
123
) : (
121
124
< Text >
122
125
< Text > { welcomeMessage . phrase1 } </ Text >
123
- < Text style = { [ styles . textStrong ] } > { ReportUtils . getDisplayNameForParticipant ( report ?. ownerAccountID ) } </ Text >
126
+ < Text style = { [ styles . textStrong ] } > { getDisplayNameForParticipant ( report ?. ownerAccountID ) } </ Text >
124
127
< Text > { welcomeMessage . phrase2 } </ Text >
125
- < Text style = { [ styles . textStrong ] } > { ReportUtils . getPolicyName ( report ) } </ Text >
128
+ < Text style = { [ styles . textStrong ] } > { getPolicyName ( report ) } </ Text >
126
129
< Text > { welcomeMessage . phrase3 } </ Text >
127
130
</ Text >
128
131
) ) }
129
132
{ isInvoiceRoom &&
130
133
! isArchivedRoom &&
131
134
( welcomeMessage ?. messageHtml ? (
132
- < PressableWithoutFeedback
133
- onPress = { ( ) => {
134
- if ( ! canEditReportDescription ) {
135
- return ;
136
- }
137
- const activeRoute = Navigation . getActiveRoute ( ) ;
138
- Navigation . navigate ( ROUTES . REPORT_DESCRIPTION . getRoute ( report ?. reportID , activeRoute ) ) ;
139
- } }
140
- style = { [ styles . renderHTML , canEditReportDescription ? styles . cursorPointer : styles . cursorText ] }
141
- accessibilityLabel = { translate ( 'reportDescriptionPage.roomDescription' ) }
142
- >
135
+ < View style = { [ styles . renderHTML , styles . cursorText ] } >
143
136
< RenderHTML html = { welcomeMessage . messageHtml } />
144
- </ PressableWithoutFeedback >
137
+ </ View >
145
138
) : (
146
139
< Text >
147
140
< Text > { welcomeMessage . phrase1 } </ Text >
148
141
< Text >
149
142
{ report ?. invoiceReceiver ?. type === CONST . REPORT . INVOICE_RECEIVER_TYPE . INDIVIDUAL ? (
150
- < Text style = { [ styles . textStrong ] } > { ReportUtils . getDisplayNameForParticipant ( report ?. invoiceReceiver ?. accountID ) } </ Text >
143
+ < Text style = { [ styles . textStrong ] } > { getDisplayNameForParticipant ( report ?. invoiceReceiver ?. accountID ) } </ Text >
151
144
) : (
152
145
< Text style = { [ styles . textStrong ] } > { getPolicy ( report ?. invoiceReceiver ?. policyID ) ?. name } </ Text >
153
146
) }
154
147
</ Text >
155
148
< Text > { ` ${ translate ( 'common.and' ) } ` } </ Text >
156
- < Text style = { [ styles . textStrong ] } > { ReportUtils . getPolicyName ( report ) } </ Text >
149
+ < Text style = { [ styles . textStrong ] } > { getPolicyName ( report ) } </ Text >
157
150
< Text > { welcomeMessage . phrase2 } </ Text >
158
151
</ Text >
159
152
) ) }
160
153
{ isChatRoom &&
161
154
( ! isInvoiceRoom || isArchivedRoom ) &&
162
155
( welcomeMessage ?. messageHtml ? (
163
- < PressableWithoutFeedback
164
- onPress = { ( ) => {
165
- const activeRoute = Navigation . getActiveRoute ( ) ;
166
- if ( canEditReportDescription ) {
167
- Navigation . navigate ( ROUTES . REPORT_DESCRIPTION . getRoute ( report ?. reportID , activeRoute ) ) ;
168
- return ;
169
- }
170
- Navigation . navigate ( ROUTES . REPORT_WITH_ID_DETAILS . getRoute ( report ?. reportID , activeRoute ) ) ;
171
- } }
172
- style = { styles . renderHTML }
173
- accessibilityLabel = { translate ( 'reportDescriptionPage.roomDescription' ) }
174
- >
156
+ < View style = { styles . renderHTML } >
175
157
< RenderHTML html = { welcomeMessage . messageHtml } />
176
- </ PressableWithoutFeedback >
158
+ </ View >
177
159
) : (
178
160
< Text >
179
161
< Text > { welcomeMessage . phrase1 } </ Text >
@@ -183,7 +165,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
183
165
onPress = { navigateToReport }
184
166
suppressHighlighting
185
167
>
186
- { ReportUtils . getReportName ( report ) }
168
+ { getReportName ( report ) }
187
169
</ Text >
188
170
) }
189
171
{ welcomeMessage . phrase2 !== undefined && < Text > { welcomeMessage . phrase2 } </ Text > }
@@ -206,7 +188,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
206
188
// eslint-disable-next-line react/no-array-index-key
207
189
< Text key = { `${ displayName } ${ index } ` } >
208
190
< UserDetailsTooltip accountID = { accountID } >
209
- { ReportUtils . isOptimisticPersonalDetail ( accountID ) ? (
191
+ { isOptimisticPersonalDetail ( accountID ) ? (
210
192
< Text style = { [ styles . textStrong ] } > { displayName } </ Text >
211
193
) : (
212
194
< Text
@@ -226,7 +208,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) {
226
208
</ Text >
227
209
) }
228
210
{ shouldShowUsePlusButtonText && < Text > { translate ( 'reportActionsView.usePlusButton' , { additionalText} ) } </ Text > }
229
- { ReportUtils . isConciergeChatReport ( report ) && < Text > { translate ( 'reportActionsView.askConcierge' ) } </ Text > }
211
+ { isConciergeChatReport ( report ) && < Text > { translate ( 'reportActionsView.askConcierge' ) } </ Text > }
230
212
</ View >
231
213
</ >
232
214
) ;
0 commit comments