-
Notifications
You must be signed in to change notification settings - Fork 4
[Draft] User Profiles with Editing #510
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dailp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| @@ -0,0 +1 @@ | |||
| export default "/profile" | |||
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 dont think this is necessary, vite does routing automatically if you have profile.page.tsx
alisony755
left a comment
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.
The editable user profile page is a useful addition! I left some comments about a few tweaks you could make, but great work overall
|
|
||
| /** Calls the backend GraphQL mutation to update a user's profile data. */ | ||
| const runUpdate = async (variables: { user: Dailp.CurrentUserUpdate }) => { | ||
| await updateUser(variables) |
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.
It might be a good idea to add error handling or a try/catch around this
| if (!file) return | ||
|
|
||
| // Validate file type | ||
| const allowedTypes = [ |
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.
Some browsers might report file types in uppercase (like "IMAGE/PNG"), so it might be a good idea to normalize with .toLowerCase()
| } | ||
|
|
||
| // Validate file size (5MB) | ||
| if (file.size > 5 * 1024 * 1024) { |
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.
You could consider making 5MB a named constant (like MAX_FILE_SIZE_MB) in case you want to reuse or change it later
Made an editable user profile page that's able to be reached from the user dropdown menu when signed in.
Uploads for the avatar are currently untested but implemented.