From 130c1ddd258f9e49ad067d0e4c11f5d421efa0e9 Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Thu, 7 Mar 2024 10:33:24 -0700 Subject: [PATCH] Refactor HeaderView to access parentReportAction from props --- src/pages/home/HeaderView.js | 10 +++++++--- src/pages/home/ReportScreen.js | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 10d2d1414c3a..2037b6231abd 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -38,6 +38,7 @@ import * as Task from '@userActions/Task'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; +import reportActionPropTypes from './report/reportActionPropTypes'; const propTypes = { /** Toggles the navigationMenu open and closed */ @@ -52,6 +53,9 @@ const propTypes = { /** Onyx Props */ parentReport: reportPropTypes, + /** The report action the transaction is tied to from the parent report */ + parentReportAction: PropTypes.shape(reportActionPropTypes), + /** URL to the assigned guide's appointment booking calendar */ guideCalendarLink: PropTypes.string, @@ -81,6 +85,7 @@ const defaultProps = { report: null, guideCalendarLink: null, parentReport: {}, + parentReportAction: {}, session: { accountID: 0, }, @@ -110,9 +115,8 @@ function HeaderView(props) { const subtitle = ReportUtils.getChatRoomSubtitle(reportHeaderData); const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(reportHeaderData); const isConcierge = ReportUtils.hasSingleParticipant(props.report) && _.contains(participants, CONST.ACCOUNT_ID.CONCIERGE); - const parentReportAction = ReportActionsUtils.getParentReportAction(props.report); - const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(props.report, parentReportAction); - const isWhisperAction = ReportActionsUtils.isWhisperAction(parentReportAction); + const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(props.report, props.parentReportAction); + const isWhisperAction = ReportActionsUtils.isWhisperAction(props.parentReportAction); const isUserCreatedPolicyRoom = ReportUtils.isUserCreatedPolicyRoom(props.report); const isPolicyMember = useMemo(() => !_.isEmpty(props.policy), [props.policy]); const canLeaveRoom = ReportUtils.canLeaveRoom(props.report, isPolicyMember); diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index da5a8e4aae27..aac4edfe29b8 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -298,6 +298,7 @@ function ReportScreen({ reportID={reportID} onNavigationMenuButtonClicked={goBack} report={report} + parentReportAction={parentReportAction} /> );