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

feat: profile view #1

Merged
merged 28 commits into from
Sep 25, 2024
Merged

feat: profile view #1

merged 28 commits into from
Sep 25, 2024

Conversation

tycebrown
Copy link
Contributor

What's Changed:

  • Added the [locale]/profile path

QA:

  1. Login.
  2. Go to the profile page. Confirm that the page autofills with the users information.
  3. Type in a password of less than 8 characters. Confirm you get a form error
  4. Type in a password of 8 characters. Type in a different password into the confirm password input. Confirm you get a form error
  5. Type the same password in both boxes. Confirm the form submits properly

@tycebrown
Copy link
Contributor Author

@arrocke Alrighty, this is finally ready. I had done most of the coding before your message in slack, so it has verification

Copy link
Member

@arrocke arrocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! A couple things to cleanup and then this should be good.

Comment on lines 13 to 18
action={async (
_prevState: FormState,
data: FormData
): Promise<FormState> => {
const formSubmissionState = await updateProfile(_prevState, data);
if (formSubmissionState.state === "error") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more nextjs way of doing this would be to call revalidatePath with the path of the profile view. That will trigger nextjs to rerender the view, which will reset the password field. Then we don't need a separate component to handle this on the client side

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arrocke I'm having difficulty getting this to work, could you review my changes and see what I am doing wrong? I addressed the other issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit to the main branch to automatically clear password inputs after a form is submitted. That should address your issue.

app/[locale]/(authenticated)/profile/actions.ts Outdated Show resolved Hide resolved
app/[locale]/(authenticated)/profile/actions.ts Outdated Show resolved Hide resolved
app/[locale]/(authenticated)/profile/actions.ts Outdated Show resolved Hide resolved
app/[locale]/(authenticated)/profile/page.tsx Outdated Show resolved Hide resolved
app/[locale]/(authenticated)/profile/page.tsx Outdated Show resolved Hide resolved
app/[locale]/(public)/reset-password/ResetPasswordForm.tsx Outdated Show resolved Hide resolved
Copy link
Member

@arrocke arrocke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ready to merge once the issues with the messages file are addressed

messages/en.json Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are still issues with this file. It looks like a bunch of stuff got added to the end. Can you take another look?

Comment on lines 13 to 18
action={async (
_prevState: FormState,
data: FormData
): Promise<FormState> => {
const formSubmissionState = await updateProfile(_prevState, data);
if (formSubmissionState.state === "error") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit to the main branch to automatically clear password inputs after a form is submitted. That should address your issue.

Comment on lines +216 to +234
"ProfileView": {
"form": {
"confirm_password": "Confirm Password",
"email": "Email",
"name": "Name",
"password": "Password",
"submit": "Update"
},
"errors": {
"email_required": "Please enter your email.",
"email_format": "Please enter a valid email.",
"name_required": "Please input your name",
"password_confirmation": "Your password confirmation does not match.",
"password_format": "Your password should be at least 8 characters."
},
"profile_updated": "Profile updated successfully!",
"title": "Profile",
"update_profile": "Update Profile"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, this is the only change I made to en.json.

@arrocke arrocke merged commit 892aa93 into globalbibletools:main Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants