-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Report Creation UI] Create entrypoint for Report creation flow. #57847
base: main
Are you sure you want to change the base?
[Report Creation UI] Create entrypoint for Report creation flow. #57847
Conversation
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@DylanDylann let's prioritize reviewing this PR when you're online since this is a critical one |
I will submit my review by end of day today. If any unexpected delays occur, I guarantee completion by Monday. |
Sorry I just applied wrong translation path, when cleaning up the code, this will be "Choose a workspace for this report." as Tom suggested here https://swmansion.slack.com/archives/C08ERETRDBK/p1741008093144109?thread_ts=1740954704.217869&cid=C08ERETRDBK |
@SzymczakJ in the video from the OP, does that account not have a default workspace selected? |
optimisticDataValue.ownerAccountID = accountID; | ||
} | ||
|
||
const optimisticData: OnyxUpdate[] = [ |
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 should be optimistic report preview too cc @trjExpensify
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.
FYI I added optimistic report preview.
|
||
const {stateNum, statusNum} = getExpenseReportStateAndStatus(policy); | ||
|
||
const optimisticDataValue: OptimisticNewReport = { |
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 action follows offline pattern B, so I think we need to add pending action to the optimistic report
src/libs/actions/Report.ts
Outdated
API.write( | ||
WRITE_COMMANDS.CREATE_APP_REPORT, | ||
{reportName, type: CONST.REPORT.TYPE.EXPENSE, policyID, reportID: optimisticReportID, reportActionID}, | ||
{optimisticData, successData: [], failureData: []}, |
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.
I added pending action and failure data, but it's not used anywhere yet, so let's not focus on it so much. I'm planning to make it better in next issue: #57654, in which I'll use offline and failure data.
As for @trjExpensify comment(#57847 (comment)):
Yes, this account has a default workspace, should we add some kind default marker in this case? Why do you ask? |
As for @shawnborton comment(#57847 (comment)): I was planning to fix that in a next issue which is adding empty state to report view and merge this issue as fast as possible, since it's blocking our next tasks. |
3b4b3d8
to
f8e88f2
Compare
Fixed your comments @DylanDylann! |
If the default workspace is a group workspace we should not show the selector. We just create the report on the default workspace. The only time we show the selector is in the edge case of:
|
I'm cool with that, as long as we have a plan to fix it :) |
Alright, now I understand this 😄. Fixed the logic the way you wanted! |
@DylanDylann Are you able to do another review? |
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 good. Left a few small comments
@@ -81,7 +81,7 @@ const ROUTES = { | |||
SEARCH_MONEY_REQUEST_REPORT: { | |||
route: 'search/report/:reportID', | |||
getRoute: ({reportID, backTo}: {reportID: string; backTo?: string}) => { | |||
const baseRoute = `search/view/${reportID}` as const; | |||
const baseRoute = `search/report/${reportID}` as const; |
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're changing this to /r
to be consistent with other routes. Discussed in https://expensify.slack.com/archives/C07NMDKEFMH/p1741479977432699
const baseRoute = `search/report/${reportID}` as const; | |
const baseRoute = `search/r/${reportID}` as const; |
return; | ||
} | ||
|
||
// If the users default workspace is personal and user has more than one group workspace which is paid and has chat enabled, we need to redirect them to workspace selection screen |
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.
// If the users default workspace is personal and user has more than one group workspace which is paid and has chat enabled, we need to redirect them to workspace selection screen | |
// If the user's default workspace is personal and the user has more than one group workspace which is paid and has chat enabled, we need to redirect them to the workspace selection screen |
return; | ||
} | ||
|
||
// If the users default workspace is paid group workspace with chat enabled, we create a report with it by default |
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.
// If the users default workspace is paid group workspace with chat enabled, we create a report with it by default | |
// If the user's default workspace is a paid group workspace with chat enabled, we create a report with it by default |
|
||
const optimisticData: OnyxUpdate[] = [ | ||
{ | ||
onyxMethod: Onyx.METHOD.SET, |
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.
Why are we using SET
here and below?
const optimisticReportID = generateReportID(); | ||
const reportActionID = rand64(); | ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
const reportName = `${creatorPersonalDetails.firstName || 'User'}'s report`; |
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 should use the policy's default report name rule stored in policy.fieldList.text_title.defaultValue
Explanation of Change
Fixed Issues
$ #57651
$ #57653
PROPOSAL:
Tests
To test you need to have
tableReportView
beta enabled.Offline tests
QA Steps
Same as tests.
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.mov
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
mwebIos.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
web.mov