Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor HeaderView to access parentReportAction from props #37913

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading