@@ -8,9 +8,7 @@ import {Keyboard, View} from 'react-native';
88import type { OnyxEntry } from 'react-native-onyx' ;
99import type { ValueOf } from 'type-fest' ;
1010import * as ActionSheetAwareScrollView from '@components/ActionSheetAwareScrollView' ;
11- import DisplayNames from '@components/DisplayNames' ;
1211import Hoverable from '@components/Hoverable' ;
13- import Icon from '@components/Icon' ;
1412import InlineSystemMessage from '@components/InlineSystemMessage' ;
1513import { ModalActions } from '@components/Modal/Global/ModalContext' ;
1614import OfflineWithFeedback from '@components/OfflineWithFeedback' ;
@@ -32,11 +30,8 @@ import UnreportedTransactionAction from '@components/ReportActionItem/Unreported
3230import { SearchStateContext } from '@components/Search/SearchContext' ;
3331import { useIsOnSearch } from '@components/Search/SearchScopeProvider' ;
3432import { ShowContextMenuActionsContext , ShowContextMenuStateContext } from '@components/ShowContextMenuContext' ;
35- import Text from '@components/Text' ;
36- import TextLink from '@components/TextLink' ;
3733import UnreadActionIndicator from '@components/UnreadActionIndicator' ;
3834import useConfirmModal from '@hooks/useConfirmModal' ;
39- import { useMemoizedLazyExpensifyIcons } from '@hooks/useLazyAsset' ;
4035import useLocalize from '@hooks/useLocalize' ;
4136import useOnyx from '@hooks/useOnyx' ;
4237import usePrevious from '@hooks/usePrevious' ;
@@ -99,10 +94,7 @@ import {
9994} from '@libs/ReportActionsUtils' ;
10095import {
10196 canWriteInReport ,
102- getChatListItemReportName ,
103- getDisplayNamesWithTooltips ,
10497 getMovedActionMessage ,
105- getWhisperDisplayNames ,
10698 isCompletedTaskReport ,
10799 isExpenseReport ,
108100 isHarvestCreatedExpenseReport as isHarvestCreatedExpenseReportUtils ,
@@ -112,7 +104,6 @@ import {
112104import SelectionScraper from '@libs/SelectionScraper' ;
113105import { ReactionListContext } from '@pages/inbox/ReportScreenContext' ;
114106import AttachmentModalContext from '@pages/media/AttachmentModalScreen/AttachmentModalContext' ;
115- import variables from '@styles/variables' ;
116107import type { IgnoreDirection } from '@userActions/ClearReportActionErrors' ;
117108import { hideEmojiPicker , isActive } from '@userActions/EmojiPickerAction' ;
118109import { expandURLPreview } from '@userActions/Report' ;
@@ -149,7 +140,9 @@ import ReportActionItemDraft from './ReportActionItemDraft';
149140import ReportActionItemGrouped from './ReportActionItemGrouped' ;
150141import ReportActionItemSingle from './ReportActionItemSingle' ;
151142import ReportActionItemThread from './ReportActionItemThread' ;
143+ import SearchActionHeader from './SearchActionHeader' ;
152144import TripSummary from './TripSummary' ;
145+ import WhisperBanner from './WhisperBanner' ;
153146
154147type PureReportActionItemProps = {
155148 /** The personal policy ID */
@@ -259,9 +252,6 @@ type PureReportActionItemProps = {
259252 /** Gets all transactions on an IOU report with a receipt */
260253 getTransactionsWithReceipts ?: ( iouReportID : string | undefined ) => OnyxTypes . Transaction [ ] ;
261254
262- /** Whether the current user is the only participant in the report */
263- isCurrentUserTheOnlyParticipant ?: ( participantAccountIDs ?: number [ ] ) => boolean ;
264-
265255 /** Function to clear an error from a transaction */
266256 clearError ?: ( transactionID : string ) => void ;
267257
@@ -333,7 +323,6 @@ function PureReportActionItem({
333323 resolveActionableReportMentionWhisper = ( ) => { } ,
334324 resolveActionableMentionWhisper = ( ) => { } ,
335325 isClosedExpenseReportWithNoExpenses,
336- isCurrentUserTheOnlyParticipant = ( ) => false ,
337326 getTransactionsWithReceipts = ( ) => [ ] ,
338327 clearError = ( ) => { } ,
339328 clearAllRelatedReportActionErrors = ( ) => { } ,
@@ -348,9 +337,8 @@ function PureReportActionItem({
348337 const isConciergeGreeting = action . reportActionID === CONST . CONCIERGE_GREETING_ACTION_ID ;
349338 const shouldDisplayContextMenuValue = shouldDisplayContextMenu && ! isConciergeGreeting ;
350339
351- const [ conciergeReportID ] = useOnyx ( ONYXKEYS . CONCIERGE_REPORT_ID ) ;
352340 const { transitionActionSheetState} = ActionSheetAwareScrollView . useActionSheetAwareScrollViewActions ( ) ;
353- const { translate, formatPhoneNumber , localeCompare , formatTravelDate, datetimeToCalendarTime} = useLocalize ( ) ;
341+ const { translate, formatTravelDate, datetimeToCalendarTime} = useLocalize ( ) ;
354342 const { showConfirmModal} = useConfirmModal ( ) ;
355343 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
356344 const reportID = report ?. reportID ?? action ?. reportID ;
@@ -374,7 +362,6 @@ function PureReportActionItem({
374362 const isReportArchived = useReportIsArchived ( reportID ) ;
375363
376364 const isHarvestCreatedExpenseReport = isHarvestCreatedExpenseReportUtils ( reportNameValuePairsOrigin , reportNameValuePairsOriginalID ) ;
377- const expensifyIcons = useMemoizedLazyExpensifyIcons ( [ 'Eye' ] ) ;
378365
379366 const [ childReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( action . childReportID ) } ` ) ;
380367 const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ getNonEmptyStringOnyxID ( report ?. chatReportID ) } ` ) ;
@@ -1124,42 +1111,10 @@ function PureReportActionItem({
11241111
11251112 const hasErrors = ! isEmptyValueObject ( action . errors ) ;
11261113 const whisperedTo = getWhisperedTo ( action ) ;
1127- const isMultipleParticipant = whisperedTo . length > 1 ;
11281114
11291115 const iouReportID = isMoneyRequestAction ( action ) && getOriginalMessage ( action ) ?. IOUReportID ? getOriginalMessage ( action ) ?. IOUReportID ?. toString ( ) : undefined ;
11301116 const transactionsWithReceipts = getTransactionsWithReceipts ( iouReportID ) ;
11311117 const isWhisper = whisperedTo . length > 0 && transactionsWithReceipts . length === 0 ;
1132- const whisperedToPersonalDetails = isWhisper
1133- ? ( Object . values ( personalDetails ?? { } ) . filter ( ( details ) => whisperedTo . includes ( details ?. accountID ?? CONST . DEFAULT_NUMBER_ID ) ) as OnyxTypes . PersonalDetails [ ] )
1134- : [ ] ;
1135- const isWhisperOnlyVisibleByUser = isWhisper && isCurrentUserTheOnlyParticipant ( whisperedTo ) ;
1136- const displayNamesWithTooltips = isWhisper ? getDisplayNamesWithTooltips ( whisperedToPersonalDetails , isMultipleParticipant , localeCompare , formatPhoneNumber ) : [ ] ;
1137-
1138- const renderSearchHeader = ( children : React . ReactNode ) => {
1139- if ( ! isOnSearch ) {
1140- return children ;
1141- }
1142-
1143- return (
1144- < View style = { [ styles . p4 ] } >
1145- < View style = { styles . webViewStyles . tagStyles . ol } >
1146- < View style = { [ styles . flexRow , styles . alignItemsCenter , ! isWhisper ? styles . mb3 : { } ] } >
1147- < Text style = { styles . chatItemMessageHeaderPolicy } > { translate ( 'common.in' ) } </ Text >
1148- < TextLink
1149- fontSize = { variables . fontSizeSmall }
1150- onPress = { ( ) => {
1151- onPress ?.( ) ;
1152- } }
1153- numberOfLines = { 1 }
1154- >
1155- { getChatListItemReportName ( action , report , conciergeReportID ) }
1156- </ TextLink >
1157- </ View >
1158- { children }
1159- </ View >
1160- </ View >
1161- ) ;
1162- } ;
11631118
11641119 // Calculating accessibilityLabel for chat message with sender, date and time and the message content.
11651120 const displayName = getDisplayNameOrDefault ( personalDetails ?. [ action . actorAccountID ?? CONST . DEFAULT_NUMBER_ID ] ) ;
@@ -1241,42 +1196,25 @@ function PureReportActionItem({
12411196 needsOffscreenAlphaCompositing = { isMoneyRequestAction ( action ) }
12421197 shouldDisableStrikeThrough
12431198 >
1244- { renderSearchHeader (
1245- < >
1246- { isWhisper && (
1247- < View style = { [ styles . flexRow , styles . pl5 , styles . pt2 , styles . pr3 ] } >
1248- < View style = { [ styles . pl6 , styles . mr3 ] } >
1249- < Icon
1250- fill = { theme . icon }
1251- src = { expensifyIcons . Eye }
1252- small
1253- />
1254- </ View >
1255- < Text style = { [ styles . chatItemMessageHeaderTimestamp ] } >
1256- { translate ( 'reportActionContextMenu.onlyVisible' ) }
1257-
1258- </ Text >
1259- < DisplayNames
1260- fullTitle = { getWhisperDisplayNames ( translate , formatPhoneNumber , whisperedTo ) ?? '' }
1261- displayNamesWithTooltips = { displayNamesWithTooltips }
1262- tooltipEnabled
1263- numberOfLines = { 1 }
1264- textStyles = { [ styles . chatItemMessageHeaderTimestamp , styles . flex1 ] }
1265- shouldUseFullTitle = { isWhisperOnlyVisibleByUser }
1266- />
1267- </ View >
1268- ) }
1269- { renderReportActionItem ( ! ! hovered || ! ! isReportActionLinked , isWhisper , hasErrors ) }
1270- </ > ,
1271- ) }
1199+ < SearchActionHeader
1200+ action = { action }
1201+ report = { report }
1202+ isWhisper = { isWhisper }
1203+ onPress = { onPress }
1204+ >
1205+ { isWhisper && < WhisperBanner whisperedTo = { whisperedTo } /> }
1206+ { renderReportActionItem ( ! ! hovered || ! ! isReportActionLinked , isWhisper , hasErrors ) }
1207+ </ SearchActionHeader >
12721208 </ OfflineWithFeedback >
12731209 </ View >
12741210 </ View >
12751211 ) }
12761212 </ Hoverable >
1277- < View style = { styles . reportActionSystemMessageContainer } >
1278- < InlineSystemMessage message = { action . error } />
1279- </ View >
1213+ { ! ! action . error && (
1214+ < View style = { styles . reportActionSystemMessageContainer } >
1215+ < InlineSystemMessage message = { action . error } />
1216+ </ View >
1217+ ) }
12801218 </ PressableWithSecondaryInteraction >
12811219 </ View >
12821220 ) ;
0 commit comments