Skip to content

Commit

Permalink
Refactor HeaderView to access parentReportAction from props
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed Mar 7, 2024
1 parent c270b5e commit 130c1dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,

Expand Down Expand Up @@ -81,6 +85,7 @@ const defaultProps = {
report: null,
guideCalendarLink: null,
parentReport: {},
parentReportAction: {},
session: {
accountID: 0,
},
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ function ReportScreen({
reportID={reportID}
onNavigationMenuButtonClicked={goBack}
report={report}
parentReportAction={parentReportAction}
/>
);

Expand Down

0 comments on commit 130c1dd

Please sign in to comment.