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

Edit profile page #91

Merged
merged 42 commits into from
Jan 6, 2024
Merged

Edit profile page #91

merged 42 commits into from
Jan 6, 2024

Conversation

SheepTester
Copy link
Member

@SheepTester SheepTester commented Nov 14, 2023

Info

Closes #87

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

Created the edit profile page, including its functionality.

I've also added some new components and utility functions, which would be helpful for other parts of the website as well:

  • An accessible Modal component for general modals.
  • A Cropper component for cropping user-selected images to a specific aspect ratio. It will also help discourage users from uploading non-images, and it enforces max file sizes by compressing the file as a JPG until it's small enough.
  • A custom hook useObjectUrl that creates an object URL for the given File, and revokes it when it's done.
  • An SCSS accessibly-hidden mixin for elements that should be tab-accessible but should also pretend to be hidden.

Changes

  • Created edit profile page
  • Applied the new utility stuff above to other parts of the site as needed, including adding the cropper to the create event form.

Type of Change

  • Bug Fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Logistics Change (A change to a README, description, or dev workflow setup like
    linting/formatting)
  • Continuous Integration Change (Related to deployment steps or continuous integration
    workflows)
  • Other: (Fill In)

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally on Desktop.
  • locally on mobile - use https://ngrok.io to get a copy on a mobile device
  • on the live deployment preview on Desktop.
  • on the live deployment preview on Mobile.
  • I have run and passed all new and existing Cypress tests. Add screenshots below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have documented my code's src/lib functions and commented hard to understand areas
    anywhere else.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Cypress testing suite passing successfully.

If you made any visual changes to the website, please include relevant screenshots below.

Desktop, dark mode Mobile, light mode
OVERWRITE ME OVERWRITE ME

image

Copy link

vercel bot commented Nov 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
membership-portal-ui-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 5, 2024 8:36am

Copy link
Contributor

@alexzhang1618 alexzhang1618 left a comment

Choose a reason for hiding this comment

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

Functionality works great! Thanks for also refactoring the other modals, EventDetailsForm, and the Add to Apple Calendar button 😁

Some questions/comments I had:

src/components/admin/event/EventDetailsForm/index.tsx Outdated Show resolved Hide resolved
src/components/common/Cropper/index.tsx Outdated Show resolved Hide resolved
src/components/common/Cropper/index.tsx Show resolved Hide resolved
src/components/profile/EditField/index.tsx Outdated Show resolved Hide resolved
src/lib/api/UserAPI.ts Outdated Show resolved Hide resolved
src/lib/hoc/withAccessType.ts Show resolved Hide resolved
src/pages/profile/edit.tsx Outdated Show resolved Hide resolved
src/pages/profile/edit.tsx Outdated Show resolved Hide resolved
src/pages/profile/edit.tsx Outdated Show resolved Hide resolved
- remove redundant async onChange
- reduce code duplication with `hasChange`
- move `handleSubmit` out of JSX
- rename `updateCurrentUser` to `updateCurrentUserProfile` so it doesn't imply you're switching users
- hide heading collapsible arrows from screenreaders
- moved icons to SocialMediaIcon component
Copy link
Contributor

@alexzhang1618 alexzhang1618 left a comment

Choose a reason for hiding this comment

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

lgtm 🚢

Copy link
Member

@farisashai farisashai left a comment

Choose a reason for hiding this comment

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

Everything looks great and functional - couple UI nitpicks.

  • I'm on mobile and a dropdown arrows shows up on both the left and right side of the details tag which seems unintended.

  • Thoughts on "Edit Profile" -> "Manage Account" since not all of the edits on this page are publicly facing.

  • We have a route on the website /logout but no links to it anywhere so far. I think this page makes the most sense to include that link since it wouldn't be used too commonly by most users.

  • I think we have something similar on some other form components but it would help a lot to highlight which fields have been edited and are currently unsaved so I can know before clicking the cancel or save button and making unintended edits.

src/lib/api/UserAPI.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@raymosun raymosun left a comment

Choose a reason for hiding this comment

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

Hey this looks great! The cropper modal is really well done. Just a few concerns:

  1. Is this delete button never available? Maybe we can remove it.
    image

  2. In dark mode, the placeholder color doesn't have enough contrast. (Also the character count color)
    image
    image

  3. Edit: I can't seem to see my current resume on the page Editedit: I deleted my cookie and it's fine, dunno what was up with that.

@raymosun
Copy link
Contributor

raymosun commented Jan 1, 2024

Everything looks great and functional - couple UI nitpicks.

  1. I'm on mobile and a dropdown arrows shows up on both the left and right side of the details tag which seems unintended.
  2. Thoughts on "Edit Profile" -> "Manage Account" since not all of the edits on this page are publicly facing.
  3. We have a route on the website /logout but no links to it anywhere so far. I think this page makes the most sense to include that link since it wouldn't be used too commonly by most users.
  4. I think we have something similar on some other form components but it would help a lot to highlight which fields have been edited and are currently unsaved so I can know before clicking the cancel or save button and making unintended edits.

Second Faris's fourth point about which fields have been edited. Right now it's a little confusing when changes are actually updated. Certain fields like profile picture and resume are updated at the moment you upload while other fields are only saved when you click save at the bottom. I think it's also a little confusing that pressing enter in one field will attempt to save all of them, including the password. Maybe we should think about moving the reset password to it's own section. Also, editing the email address is a pretty big change since it require's reverifying your email and I wonder if people can get locked out of their accounts by changing it, so maybe that field also needs more warning. Perhaps we can take inspiration from the v1 profile edit page where each section, separated by lines, gets saved together.

However, I think we should go ahead and merge this branch and then address those issues in a future PR.

@SheepTester
Copy link
Member Author

3. Edit: I can't seem to see my current resume on the page Editedit: I deleted my cookie and it's fine, dunno what was up with that.

Your cookie caches your user data locally, so it can get stale when you make changes to your profile (such as earning points) from a different browser or device. We probably should look into better ways to store the user object

- make placeholder/char count more visible in dark mode
- actually update the user's resume visibility preference
- update edit profile -> manage account
- position sticky the save button when there are unsaved changes
- made dark-text-on-bg-2 (the placeholder color) distinct from -bg-1

removing overflow: auto on main was to allow for position: sticky. it seems to have come from the leaderboard PR so whatever
- fix iOS Safari double arrow
- fix select being unreadable (white on white) in dark mode
- ensure `user` object is up to date
Copy link
Member

@farisashai farisashai left a comment

Choose a reason for hiding this comment

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

I think the reset password form should be separate visually and with its own action button since it's destructive and not the same as updating profile fields. aside from that, this should be fine to merge and iterate later

@SheepTester SheepTester merged commit dd7eaae into main Jan 6, 2024
4 checks passed
@SheepTester SheepTester deleted the sean/edit-profile branch January 6, 2024 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Edit User Profile Page
4 participants