-
Notifications
You must be signed in to change notification settings - Fork 565
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
feat(ONYX-986): support save and exit in new submission flow #10281
Conversation
draft: { | ||
values: ArtworkDetailsFormModel | ||
currentStep: string | ||
navigationState: any | ||
} | null | ||
setDraft: Action<this, this["draft"]> |
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.
Since we want to back the submission with my collection's artwork model, this should be a fine place to add it. We have a submission model that is powering the existing model, but it's currently so full of other stuff that doesn't make sense here and I couldn't use it just in case we roll back the FF.
69e805d
to
17c3dad
Compare
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 don't really understand what this PR is doing. Could you elaborate a bit on what "Save and Exit" means and how you've implemented it, please? The feature flag description says "Enable save and continue submission flow." which sounds more like what I understand from reading the code and looking at the screen recording.
Fair enough - I will add more details |
I just saw that you've added a description to the ticket. Now I understand what this PR is doing 💡 |
I just updated the description of the PR as well, I apologize again 🙏 |
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.
Although this solution works, intuitively, I would say that this feature should rather be built on a RESTful edit route: /sell/submissions/:submissionID/edit
. This URL could then accept a parameter to define the initial step the screen opens, such as ?initialStep=artworkDetails
.
For the "Continue previous submission" button to work, the "Save and Exit" button could store the current step and submission ID on the device and make it accessible to link to /sell/submissions/:submissionID/edit?initialStep=:initialStep
.
I'm happy to jump on a call to discuss these solutions 🤙
Your comment makes total sense - I think I can get to support that with not much effort. Let's do it together |
de72c62
to
ea8241f
Compare
@olerichter00 I continued on our progress yesterday, please let me know if there is something else to change. |
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.
Looks great! 🌟
I've added a few comments here and there ✍️
draft: { | ||
submissionID: string | ||
currentStep: string | ||
} | null | ||
setDraft: Action<this, this["draft"]> |
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.
Could we move this state somewhere else? It does not seem to be related directly to My Collection.
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.
makes sense
// Reset form if user is on the last step | ||
// This is to ensure that the user can start a new submission | ||
// This is not required but is a nice to have as a second layer of protection | ||
GlobalStore.actions.myCollection.setDraft(null) |
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 when the user has finished the submission, right? And in this case, we don't want to show the button anymore because there is no submission to continue...
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.
yes exactly
// TODO: Better error handling | ||
if (!data?.submission) { | ||
return ( | ||
<Flex flex={1} alignItems="center" justifyContent="center"> | ||
<Text variant="sm-display">Submission not found</Text> | ||
</Flex> | ||
) | ||
} |
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.
Could we use the "Unable to load" screen here?
export const LoadFailureView: React.FC<LoadFailureViewProps & BoxProps> = ({ |
@@ -45,6 +52,34 @@ export type SubmitArtworkStackNavigation = { | |||
ArtistRejected: undefined | |||
} | |||
|
|||
export const SubmitArtworkFormEdit: React.FC<SubmitArtworkProps> = withSuspense((props) => { |
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.
What do you think about moving this into its own file? This file now exports two components.
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.
sure - makes sense
|
||
const showContinueSubmission = !!enableSaveAndContinue && !!draft?.submissionID |
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.
const showContinueSubmission = !!enableSaveAndContinue && !!draft?.submissionID | |
const showContinueSubmission = !!enableSaveAndContinue && !!draft?.submissionID | |
/** | ||
* @deprecated | ||
* Please use ArtworkDetailsFormModel from app/Scenes/SellWithArtsy/ArtworkForm/Utils/validation.ts | ||
*/ |
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.
👏
@@ -184,3 +272,17 @@ export const getCurrentRoute = () => | |||
__unsafe__SubmissionArtworkFormNavigationRef.current?.getCurrentRoute()?.name as | |||
| keyof SubmitArtworkStackNavigation | |||
| undefined | |||
|
|||
const getInitialNavigationState = (initialStep: SubmitArtworkScreen) => { |
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.
minor: This could get into a helper or util file to keep this file a bit smaller and clearer.
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
ea8241f
to
51c046b
Compare
⟥⸻PR Description Up To Date [Friday 24th May 10:47 CEST] ⸻⟤
This PR resolves ONYX-986
Description
This PR makes the Save & Exit button in the new submission flow functional.
What we currently have:
Expected behaviour:
Main challenges:
1. What data to save when the user taps on Save & Exit?
Currently, I am saving the entire formik state and injecting it as it is, However, we can soon move toward saving only the submission id and querying for the data on screen mount. I didn't do that initially because we are going to get rid of this logic once we back up submissions with my collection artworks and have cross platform save and exit experience.submissionID
and the last active step. We use thesubmissionID
to query for the data2. How to restore the previous navigation state and get the user to continue from where they left
initialState
prop to inject the a partial navigation state. We are rebuilding it on mount and validating that the routes existDownsides of this approach
This works only for App. This is fine though since we want to first see how it performs when it comes to clicks before investing more effort.
Screen.Recording.2024-05-23.at.13.05.32.mov
PR Checklist
To the reviewers 👀
Changelog updates
Changelog updates
Cross-platform user-facing changes
iOS user-facing changes
Android user-facing changes
Dev changes
Need help with something? Have a look at our docs, or get in touch with us.