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

Private notes improvements #28105

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 19 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3561,6 +3561,24 @@ function getReportPreviewDisplayTransactions(reportPreviewAction) {
);
}

/**
* Navigates a user to either privateNotesListPage if there are multiple notes accessible by the user on the report or to the privateNotesViewPage if there is just a single note
* @param {*} report
* @param {*} accountID
*/
function navigateToPrivateNotesPage(report, accountID = currentUserAccountID) {
if (!report) {
return;
}

// Get all the private notes on the report
const privateNotes = lodashGet(report, 'privateNotes', {});

if (_.keys(privateNotes) === 1) {
Navigation.navigate(ROUTES.getPrivateNotesViewRoute(report.reportID, accountID));
}
Navigation.navigate(ROUTES.getPrivateNotesListRoute(report.reportID));
}
export {
getReportParticipantsTitle,
isReportMessageAttachment,
Expand Down Expand Up @@ -3701,4 +3719,5 @@ export {
getReportPreviewDisplayTransactions,
getTransactionsWithReceipts,
hasMissingSmartscanFields,
navigateToPrivateNotesPage,
};
2 changes: 1 addition & 1 deletion src/pages/PrivateNotes/PrivateNotesEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) {
autoCorrect={false}
autoGrowHeight
textAlignVertical="top"
containerStyles={[styles.autoGrowHeightMultilineInput]}
containerStyles={[styles.privateNotesMultilineInput]}
defaultValue={privateNote}
value={privateNote}
onChangeText={(text) => setPrivateNote(text)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function ProfilePage(props) {
title={`${props.translate('privateNotes.title')}`}
titleStyle={styles.flex1}
icon={Expensicons.Pencil}
onPress={() => Navigation.navigate(ROUTES.getPrivateNotesListRoute(chatReportWithCurrentUser.reportID))}
onPress={() => ReportUtils.navigateToPrivateNotesPage(chatReportWithCurrentUser)}
wrapperStyle={styles.breakAll}
shouldShowRightIcon
brickRoadIndicator={Report.hasErrorInPrivateNotes(chatReportWithCurrentUser) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function ReportDetailsPage(props) {
translationKey: 'privateNotes.title',
icon: Expensicons.Pencil,
isAnonymousAction: false,
action: () => Navigation.navigate(ROUTES.getPrivateNotesListRoute(props.report.reportID)),
action: () => ReportUtils.navigateToPrivateNotesPage(props.report),
brickRoadIndicator: Report.hasErrorInPrivateNotes(props.report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '',
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2992,6 +2992,10 @@ const styles = (theme) => ({
maxHeight: 115,
},

privateNotesMultilineInput: {
maxHeight: 225,
},

peopleRow: {
width: '100%',
flexDirection: 'row',
Expand Down
Loading