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
Combine edit profile and edit home in one page with tabs #1200
Conversation
BREAKING CHANGE: the username is now REQUIRED in profile urls. Example routes: user/aapeli user/aapeli/about (same as user/aapeli) user/aapeli/home user/edit/aapeli user/edit/aapeli/home user/edit/aapeli/about (same as user/edit/aapeli) When current route is user/aapeli/home and user clicks the 'edit' button, then user the route is changed to user/edit/aapeli/home. Next when the user clicks 'save', the route is changed again to user/aapeli/home. So you stay on the profile section you were editing/viewing."
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.
This is much better, thanks!
app/frontend/src/features/profile/edit/EditHostingPreference.tsx
Outdated
Show resolved
Hide resolved
app/frontend/src/features/profile/hooks/useUpdateUserProfile.ts
Outdated
Show resolved
Hide resolved
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.
Looks good, waaay cleaner now. But we need username to not be required in URLs.
For your first point, we can prevent specific usernames in the backend. Good point on wanting to share profile, we can satisfy this and the requirement with:
- /user/ redirects to /user/aapeli
- /user/about redirects to /user/aapeli/about
- /user/home redirects to /user/aapeli/home
The reason for this is that we link to profile and editing pages in a number of places so that needs to be generic.
I don't think either point applies to edit now. The only use case for sharing is people showing others how to edit their own profile, so it would be better not to have the username in that URL at all. It's sufficient to just have
- /user/edit
- /user/edit/about
- /user/edit/home
Also, and might just be a me thing, I couldn't see the About/Home tabs immediately. Could be a question for UX because I understand we want to be consistent.
Agreed with what's said here already. In particular, we shouldn't have |
Wow, you are all very fast with reviewing! 👍 I've already adjusted the routing issues and will continue the other remarks as well as merging develop branch tonight. |
Hi, just a heads up, if you change the routes, please remember to fix up also |
I'm assuming this is ready for review now - remember to request so we know! :) |
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.
Nice work!
There's a variable accidental rename and just a few other nits
app/frontend/src/features/profile/hooks/useUpdateHostingPreferences.ts
Outdated
Show resolved
Hide resolved
app/frontend/src/features/profile/hooks/useUpdateUserProfile.ts
Outdated
Show resolved
Hide resolved
@aapeliv @darrenvong @lucaslcode thank you all for reviewing. I'm still busy with this PR. I had some trouble on finding the best routes with optional usernames. /User/home (for route user/username?/tab?) Still don't know how the frontend can now for such route whether 'home' is a user or a tab on the profile page. Except for hardcoding something like: const user,tab = useParams() If user === home || user === about This long weekend I was visiting my family in law in Czechia so I pushed my changes already in case I would have some spare time here :) This week Ill have some more time again. I'll work on your feedback and add tests. |
Ah didn't know about these, so good that you mentioned it. I've added the new routes to both these files. But not sure if they should support the 'tab' parameter as well. Let me know if changes are required. |
The typescript overloads were a little overkill here indeed. Having two seperate functions greatly simplifies it.
@thdk: how're you doing on this one? |
I have no computer with me this weekend as I'm on a family trip.
I'll finish it beginning of this week.
Op zo 23 mei 2021 22:13 schreef Aapeli Vuorinen ***@***.***>:
… @thdk <https://github.com/thdk>: how're you doing on this one?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1200 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABABVDV4YXOBI5ZWH5F76RLTPFOWBANCNFSM44PL6MWQ>
.
|
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 TabBar
thing is minor really and I was happy to leave it if there wasn't anything else... but since your merge here is introducing a bug by replacing the user invalidation on save (by accident I hope!), thought I'll point it out as you might as well fix both together
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.
Sorry I didn't review this as quickly, there's also a merge conflict with develop now but hopefully this should be it once fixed 🤞
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 shouldn't have been prettier issues - I just updated prettier. Try running yarn && yarn format
Auch, now I have even more changes.. I'll commit them so you can see if that's normal. |
It closes #949 at least partially and is the start of some changes to the profile pages to better match the design from figma.
There now is a single page with two tabs. One tab for 'about' and another one for 'home'. I've added routes so you can directly navigate to a specific tab. Also after saving the form, you'll be redirected to the related view with the updated information.
BREAKING CHANGE: the username is now REQUIRED in profile urls.
Example routes:
user/aapeli
user/aapeli/about (same as user/aapeli)
user/aapeli/home
user/edit/aapeli
user/edit/aapeli/home
user/edit/aapeli/about (same as user/edit/aapeli)
When current route is user/aapeli/home and user clicks the 'edit' button,
then user the route is changed to user/edit/aapeli/home.
Next when the user clicks 'save', the route is changed again to user/aapeli/home.
So you stay on the profile section you were editing/viewing.
Let me know if this is not what we want, I have little experience with best practices for routes.
My argument for having the user id in the url is:
Regarding the Account Settings button. There is an option to add the account settings as another tab on the edit profile page. However, @ItsiW said it actually belongs in the hamburger menu so I left it as is for now. On the top right of the edit profile page.
Frontend checklist
yarn format && yarn lint --fix
yarn lint
=> I can probably still write (or copy) the existing test that we now have for edit hosting preferences for edit profile tab.