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
Feature/account page #900
base: develop
Are you sure you want to change the base?
Feature/account page #900
Conversation
Removed unused variable,functions and hooks calls from LoginForm
Added Only UI part of the Account Page described in issue chaynHQ#865
Refactored Signout logic code across 3 files using custom hook useAuth
Added Functionality for profile data updates
Added Functionality to update email preferences in account settings
Added Caution modal for account deletion
Disabled delete Account Button as API is not made to delete user on its own
@anmol-fzr is attempting to deploy a commit to the Chayn Team on Vercel. A member of the Team first needs to authorize it. |
Fixed Strings must use Single Quote Error by elint
Thanks so much for this, loads of work 🎉 I know that this PR is WIP so apologies for all the comments. I had a look through the code in combination with the current functionality that we had in the backend. These are my comments:
Sorry for the long list of comments! What you have done so far is great. Thank you for all your work. Please do keep the work that isn't going to be included in this PR and we can use it in the very near future. |
| React.ReactElement<any, string | React.JSXElementConstructor<any>> | ||
>(); | ||
const [emailInput, setEmailInput] = useState<string>(''); | ||
const [passwordInput, setPasswordInput] = useState<string>(''); | ||
const [getUser, { isLoading: getUserIsLoading }] = useGetUserMutation(); | ||
const [getUser] = useGetUserMutation(); |
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.
Just wondering about these changes - I assume this code was unused?
@@ -91,7 +89,6 @@ const LoginForm = () => { | |||
}) | |||
.catch((error) => { | |||
const errorCode = error.code; | |||
const errorMessage = error.message; | |||
|
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 here - assume this was unused code?
components/account/EmailPref.tsx
Outdated
const cPerms = useTypedSelector(state => state.user.contactPermission) | ||
const sPerms = useTypedSelector(state => state.user.serviceEmailsPermission) | ||
|
||
console.log({ cPerms, sPerms }) |
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.
console.logs and commented out code
pages/account/settings.tsx
Outdated
const [updateUser, { isLoading: updateUserIsLoading }] = useUpdateUserMutation(); | ||
|
||
useEffect(() => { | ||
if (userCreatedAt && userServiceEmailsPermission === true) { |
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 I see where you have copied this from. This shouldn't be there, that functionality is only for the disable-service-email.tsx page.
components/account/EmailPref.tsx
Outdated
const payload = { | ||
contactPermission, serviceEmailsPermission | ||
} | ||
updateUser(payload) |
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.
Add an await and ensure that we are handling the error/ success scenarios 😄
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.
@anmol-fzr let me know if you have any questions about this change
components/account/EmailPref.tsx
Outdated
name='sPerms' | ||
aria-label={t('checkbox.emailOnCourse')} | ||
defaultChecked={sPerms} | ||
// checked={emailPerms} |
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.
Please remove commented out code ⭐
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.
@anmol-fzr let me know if you have any questions about this change
@@ -0,0 +1,32 @@ | |||
describe('User should be able to update his profile', () => { | |||
const publicEmail = Cypress.env("public_email") | |||
|
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.
See overall comment about what sort of functionality this should be testing. 😄
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.
@anmol-fzr this cypress test doesn't address the scenarios that was specified in the ticket. Let me know if you have any questions!
@@ -0,0 +1,49 @@ | |||
import { Typography, CardContent, Card, Button } from '@mui/material' |
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.
For now, lets exclude this file from the PR. I can review this properly in the next iteration of this page. 🙏 Thanks so much for doing it though!
remove profile update feature and disabled inputs with pre-populated data as mention in Chat
update user-profile-update test to make sure that input is disabled
@eleanorreem I made the code changes suggested in the chat please take a look in to it. |
Thanks for your changes! They look great. There were a few more changes that were on PR. It would be great if they could be resolved. These are the ones outstanding:
|
removed account action from settings page
@anmol-fzr, thanks for all your work so far! Just checking in here to make sure you have everything you need to finish off this ticket. Absolutely no pressure, it would just be great to get this contribution merged! |
@eleanorreem , I made the changes to the code suggest in this review please check. |
return | ||
} | ||
|
||
verifyBeforeUpdateEmail(currUser, newEmail).then((res) => { |
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.
On email update is no longer in use so should probably be removed.
Hi thank you for your quick reply and all the work so far! There were a few more things that I commented on your pull request - take a look through the pull request files. There are some unresolved comments that need to be addressed before I can merge. |
@eleanorreem I made change told last time about removing account action card to header alignment. It would be great if you review the code for merge or we resolve anything that needs to be done for this PR |
Hiya @anmol-fzr, Thanks for your response 😄 There are these open comments on your PR. Let me know if you have any questions. I linked to the most of the comments here.
Please check through the open comments and make sure they are all resolved. Thanks in advance for everything ! |
Removed Account Actions Component will do that in some other PR
@eleanorreem i made suggested changes, please check |
Issue
Issue Number: 865
Issue Link: #865
What changes did you make?
Added Account Page with UI + Functionality + Translations. Delete Account button is intentionally left disabled reason being API to delete account by user isn't ready
Why did you make the changes?
Changes are made to fix the issue
Did you run tests?
Added a test named user-profile-update that ran successfully