-
Notifications
You must be signed in to change notification settings - Fork 19
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
343 add validation to user signup form #363
Conversation
|
||
Object.keys(initialFormData).forEach((key) => { | ||
//@ts-ignore | ||
initialFormData[key].value = initData[key]; |
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've used // @ts-ignore
on multiple lines as an escape hatch as I'm not sure how to get this to work with TypeScript. If you guys have any ideas on how I could/should do this, that'd be awesome.
Regarding Passwords in the Video: See video - I noticed that going back to the first password may still allow proceeding. Though this might be a minor correction since it's not typical user behavior, I thought it might be worth looking into. Nice work, looks clean Screen.Recording.2023-08-03.at.12.06.56.AM.mov |
Concerning the Upload Button Overlay: |
Console Log Clean-Up: |
Error with 'Bio' Column in UsersService:
In addition this also overlayed the words "Loading" over the back button (see screenshot) Since I'm not as familiar with the backend, I feel it might be beneficial to have someone more familiar with the backend take a look at this part of the project Overall Great job, really like what you did here and there is a lot of good work here! |
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.
@marvinsjsu , thanks for working on this. If we want to use redux going forward, we'll probably need to update other forms and remove other libraries (probably for another PR).
client/package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"@mui/base": "^5.0.0-beta.2", | |||
"@mui/icons-material": "^5.11.16", | |||
"@mui/material": "^5.13.2", | |||
"@reduxjs/toolkit": "^1.9.5", |
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.
@marvinsjsu , do we want to settle on redux
without any other form library? If so, we'll also want to add some cards to remove react-query
and react-hooks-form
. There are a few forms (signupnonprofit) using it. I like Redux' separation of concerns, but one downside is all the boilerplate.
Either way, I'm down with it.
…e last step, StepFive component
hi @esteban-gs and @EtoKruto, I've updated this PR based on the feedback, but I'm going to work on the styling in the other ticket I have - https://github.com/orgs/Nonprofit-Exchange-Hub/projects/14?pane=issue&itemId=33617416 (since this PR is getting kinda big and the other ticket is more for styling changes anyways). I think it's ready for another look. Thanks guys! |
…ack/react-query-devtools to dev dep
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.
@marvinsjsu , thank you for tackling this! I think we are getting close to being ready. I left a couple of comments and one blocking comment about the last step not working as intended.
<Button type="submit" color="primary" variant="outlined"> | ||
Next | ||
</Button> |
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.
Step 4 data (bio) isn't getting merged with the rest of the data. Maybe you need to call the handleNext
parent method as well.
const { status, data } = useQuery({ | ||
queryKey: ['user-email-exists', formData['email'].value], | ||
queryFn: () => Endpoints.checkUserEmail(formData['email'].value), | ||
enabled: userEmailQueryEnabled, | ||
}); |
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 we should leave this query out of this iteration until we define this further. What do you think?
|
||
const makeChips = () => { | ||
return interests.map((interest) => { | ||
// TODO: toggle chip style when interest is chosen |
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.
// TODO: toggle chip style when interest is chosen |
@Get('user-email-exists/:email') | ||
@ApiOperation({ summary: 'Check if a user email already exists.' }) | ||
async userEmailExists(@Param('email') email: string) { | ||
try { | ||
const user = await this.usersService.findByEmail(email); | ||
return Boolean(user); | ||
} catch (error) { | ||
return false; | ||
} | ||
} | ||
|
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.
My suggestion is to leave this new public endpoint out of this PR until we solve this issue further.
@Get('user-email-exists/:email') | |
@ApiOperation({ summary: 'Check if a user email already exists.' }) | |
async userEmailExists(@Param('email') email: string) { | |
try { | |
const user = await this.usersService.findByEmail(email); | |
return Boolean(user); | |
} catch (error) { | |
return false; | |
} | |
} |
@esteban, thanks for catching the bug with |
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 is one linting rule exception comment that's tripping up the build. LGTM after that's addressed 🚢
// eslint-disable-next-line prettier/prettier | ||
doSubmit | ||
? setSubmitForm(true) | ||
: setActiveStep((prevActiveStep) => prevActiveStep + 1); |
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.
prettier doesn't like this in-line warning disabling comment. See the build errors.
You should be able to just format it in a single line to get rid of the lint warning.
// eslint-disable-next-line prettier/prettier | |
doSubmit | |
? setSubmitForm(true) | |
: setActiveStep((prevActiveStep) => prevActiveStep + 1); | |
doSubmit ? setSubmitForm(true) : setActiveStep((prevActiveStep) => prevActiveStep + 1); |
@marvinsjsu This PR is under review but its not under the In progress vertical. Shouldn't this be moved under in progress? |
Dev Summary
FIgma User SIgn Up flow
This adds validation to the fields in the User Sign Up form. It also refactors the UI into multiple step components and updates the display of errors to be under the field instead of under the label. This also adds
redux
for state management foruser
entity, andredux-thunk
for sending thePOST
request to the backend to create the user account.The work was starting to have scope-creep, so created some follow-up tickets:
Test Plan
To test, go to the User Signup form via
http://localhost:3000/signup-citizen
.Note:
During account creation on my local, I was getting an error regarding
SendGrid
-web-app/server/src/acccount-manager/account-manager.controller.ts
Line 105 in cc54d36
SENDGRID_API_KEY
in my.env
.React-query tutorial: https://www.youtube.com/watch?v=r8Dg0KVnfMA