-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Tweaks to the expense flow #53760
base: main
Are you sure you want to change the base?
Tweaks to the expense flow #53760
Conversation
🚧 @trjExpensify has triggered a test build. You can view the workflow run here. |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
…aks-to-create-expense-flow
@trjExpensify is there a separate PR that just gets rid of the Track & Submit options and replaces it with the Create flow? Wasn't sure if we were doing that here or elsewhere. cc @anmurali for thoughts too |
That's a neat idea! |
Separate PR & issue here: #53952 |
…aks-to-create-expense-flow
@JKobrynski is this ready for a re-review? |
@trjExpensify not yet! Should be ready tomorrow |
…aks-to-create-expense-flow
@trjExpensify I created a |
@suneox can you re-review today please? Thanks! |
Yes, I'll continue the checklist within a few hours |
Great stuff, thanks! @JKobrynski looks like TypeScript Checks are failing? |
…aks-to-create-expense-flow
289a95c
to
d56d865
Compare
src/libs/OptionsListUtils.ts
Outdated
let workspaceChats: ReportUtils.OptionData[] = []; | ||
|
||
if (shouldSeparateWorkspaceChat) { | ||
workspaceChats = allReportOptions.filter((option) => option.isOwnPolicyExpenseChat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, thanks!
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-20.at.21.29.51.mp4Android: mWeb ChromeScreen.Recording.2024-12-20.at.21.17.15.mp4iOS: NativeScreen.Recording.2024-12-20.at.21.10.17.mp4iOS: mWeb SafariScreen.Recording.2024-12-20.at.20.30.24.mp4MacOS: Chrome / SafariScreen.Recording.2024-12-20.at.20.26.40.mp4MacOS: DesktopScreen.Recording.2024-12-20.at.21.02.42.mp4 |
src/libs/OptionsListUtils.ts
Outdated
if (typeof config?.maxRecentReportsToShow === 'number' && filteredWorkspaceChats && filteredWorkspaceChats?.length > config.maxRecentReportsToShow) { | ||
filteredWorkspaceChats = filteredWorkspaceChats.slice(0, config.maxRecentReportsToShow); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trjExpensify Should we set a limitation to show for the workspace list similar to recent reports, or show all available workspace options like in this demo?
Screen.Recording.2024-12-20.at.21.14.58.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think we'd always show all workspaces there... for most people it would be uncommon to have a ton of workspaces like you are showing above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, agreed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the confirmation. @JKobrynski we can remove this condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes LGTM. Just only need confirmation on the configuration for the number of workspace options to display.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing well, nice work!
@JKobrynski could you fix conflicts 🙏 |
…aks-to-create-expense-flow
Conflicts resolved! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to double check the correct default values based on the new guidelines. I am not sure if this is correct cc @suneox
src/libs/OptionsListUtils.ts
Outdated
@@ -492,7 +496,7 @@ function getIOUReportIDOfLastAction(report: OnyxEntry<Report>): string | undefin | |||
* Get the last message text from the report directly or from other sources for special cases. | |||
*/ | |||
function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails: Partial<PersonalDetails> | null, policy?: OnyxEntry<Policy>): string { | |||
const reportID = report?.reportID ?? '-1'; | |||
const reportID = report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this we should never default to string value cc @VickyStash
const reportID = report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID); | |
const reportID = report?.reportID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mountiny Correct!
Also, this file is in the list of ignored files as it can be tricky to update it directly, so you should be able to skip id updates here and the lint will pass on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JKobrynski would you be able to update this please?
src/libs/OptionsListUtils.ts
Outdated
@@ -548,9 +552,16 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails | |||
lastMessageTextFromReport = ReportUtils.getReimbursementDeQueuedActionMessage(lastReportAction, report, true); | |||
} else if (ReportActionUtils.isDeletedParentAction(lastReportAction) && ReportUtils.isChatReport(report)) { | |||
lastMessageTextFromReport = ReportUtils.getDeletedParentActionMessageForChatReport(lastReportAction); | |||
} else if (ReportActionUtils.isPendingRemove(lastReportAction) && ReportActionUtils.isThreadParentMessage(lastReportAction, report?.reportID ?? '-1')) { | |||
} else if (ReportActionUtils.isPendingRemove(lastReportAction) && ReportActionUtils.isThreadParentMessage(lastReportAction, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#default-value-for-inexistent-ids
} else if (ReportActionUtils.isPendingRemove(lastReportAction) && ReportActionUtils.isThreadParentMessage(lastReportAction, report?.reportID ?? String(CONST.DEFAULT_NUMBER_ID))) { | |
} else if (ReportActionUtils.isPendingRemove(lastReportAction) && ReportActionUtils.isThreadParentMessage(lastReportAction, report?.reportID)) { |
src/libs/OptionsListUtils.ts
Outdated
} else if (ReportUtils.isReportMessageAttachment({text: report?.lastMessageText ?? '-1', html: report?.lastMessageHtml, translationKey: report?.lastMessageTranslationKey, type: ''})) { | ||
} else if ( | ||
ReportUtils.isReportMessageAttachment({ | ||
text: report?.lastMessageText ?? String(CONST.DEFAULT_NUMBER_ID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I am not sure if I am misunderstanding the guidelines. It just feels like the empty string might be better here
text: report?.lastMessageText ?? String(CONST.DEFAULT_NUMBER_ID), | |
text: report?.lastMessageText ?? '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think eslint check even shouldn't complain on this place, as it's not ID.
@JKobrynski Correct me if I'm wrong.
src/libs/OptionsListUtils.ts
Outdated
}: GetOptionsConfig = {}, | ||
): Options { | ||
const topmostReportId = Navigation.getTopmostReportId() ?? '-1'; | ||
const topmostReportId = Navigation.getTopmostReportId() ?? String(CONST.DEFAULT_NUMBER_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the same
const topmostReportId = Navigation.getTopmostReportId() ?? String(CONST.DEFAULT_NUMBER_ID); | |
const topmostReportId = Navigation.getTopmostReportId(); |
src/libs/OptionsListUtils.ts
Outdated
@@ -1234,7 +1278,7 @@ function getValidOptions( | |||
const shouldShowInvoiceRoom = | |||
includeInvoiceRooms && | |||
ReportUtils.isInvoiceRoom(reportOption.item) && | |||
ReportUtils.isPolicyAdmin(reportOption.policyID ?? '', policies) && | |||
ReportUtils.isPolicyAdmin(reportOption.policyID ?? String(CONST.DEFAULT_NUMBER_ID), policies) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return early in the method if the value is undefined
ReportUtils.isPolicyAdmin(reportOption.policyID ?? String(CONST.DEFAULT_NUMBER_ID), policies) && | |
ReportUtils.isPolicyAdmin(reportOption.policyID), policies) && |
src/libs/OptionsListUtils.ts
Outdated
isSelected: member.isSelected ?? false, | ||
isDisabled: member.isDisabled ?? false, | ||
accountID, | ||
login: member.login ?? '', | ||
icons: member.icons, | ||
pendingAction: member.pendingAction, | ||
reportID: member.reportID ?? '-1', | ||
reportID: member.reportID ?? String(CONST.DEFAULT_NUMBER_ID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reportID: member.reportID ?? String(CONST.DEFAULT_NUMBER_ID), | |
reportID: member.reportID, |
@@ -168,7 +158,7 @@ function MoneyRequestParticipantsSelector({ | |||
|
|||
const formatResults = OptionsListUtils.formatSectionsFromSearchTerm( | |||
debouncedSearchTerm, | |||
participants.map((participant) => ({...participant, reportID: participant.reportID ?? '-1'})), | |||
participants.map((participant) => ({...participant, reportID: participant.reportID ?? String(CONST.DEFAULT_NUMBER_ID)})), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
participants.map((participant) => ({...participant, reportID: participant.reportID ?? String(CONST.DEFAULT_NUMBER_ID)})), | |
participants.map((participant) => ({...participant, reportID: participant.reportID})), |
@JKobrynski is OOO till Dec 27th 🎄 |
@mountiny I removed these string id fallbacks according to your comments, feel free to give it another look! |
Explanation of Change
Implement the requirements specified in this comment
FYI
Screen title changes that were specified in the above comment were already implemented thus they are not included in this PR.
Fixed Issues
$ #52981
PROPOSAL: N/A
Tests
Offline tests
Same as Tests section above
QA Steps
Same as Tests section above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-compressed.webm
Android: mWeb Chrome
chrome-compressed.webm
iOS: Native
ios-compressed.mp4
iOS: mWeb Safari
safari-compressed.mp4
MacOS: Chrome / Safari
MacOS: Desktop