-
Notifications
You must be signed in to change notification settings - Fork 7
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
Profile fields should have an edit capability #347
Comments
…SocialLinks, fix type errors with props
Today we mostly worked on the social network input fields. We created state in the Previously, we created editable fields for the username, email, and bio. Things to work on:
|
Merging in recent changes from #356 so we can test the editing functionality on the backend.
Added in the latest changes from #356, so now you should be able to receive an IUserData object from the database, render it, edit it, and send it back to the database (in an HTTP PUT request). The API will handle all the comparisons to see if anything has updated so that you don't have to do anything special to keep track of changes on the frontend or call different methods for different fields that are added/modified/removed. |
Latest changes switch from principal_id to id in many cases, conforming to Entity interface and allowing the app to talk to the API.
Working with Antonina to have the social profiles that we get back from the API to be rendered properly.
…ix warnings, add icons for social network
This commit fully removes profile editing capability but now correctly renders a row of social profile icons.
If the greeting functions are passed a null person's name, just say the greeting; for example "Good morning!" instead of "Good morning, Spencer!"
Bare-bones skeleton of editing functionality, bringing back the clickable pencil icon (which may or may not survive, who knows). Also, a button that tests updating the userData in-state so we can eventually send it back to the API.
When you click into edit mode, you can now see some form fields that are pre-filled with the data from your profile.
This includes the changes that were needed once the HTTP PUT route we made could finally be tested.
This commit cleans up a lot of the React-isms: we're not calling the API multiple times, state is being better preserved, and we're finally properly using the session's principal ID. Plus, this has a working demo of HTTP PUT in action! (only for full_name though).
Hello, OpenTree family! I'm wrapping up for the evening and I'd like to share my progress of where I'm at for the day. Compared with the state last night, the profile page is now pulling directly from the database for its information with absolutely no placeholder content. (Sorry to our fictional test user!) Huge thanks to @achichikalova and @Nazanin-Rezaei for getting that work started this morning on the front end and to @SiriusLL for working late last night to try tying in the backend stuff. This afternoon, I completely re-architected the editing / saving functionality based on combining both teams’ work with React best practices. The user data is now being properly loaded into the profile page's state from the API and is being rendered on the front end. Changes to the user data within the state variable get reflected on the page immediately. And that user data object can now be sent to the server for updates! I've also updated the Here's a quick overview of how it looks right now. This is just after first logging in (although I cheated and added some extra social profiles in my database so you could see how it looks with multiple profiles defined): This is after clicking the edit button (sorry, I haven't styled anything yet): And finally, this is after clicking that big "Change My Name to Something Else" button, which changes the full_name in the userData state variable to "OpenTree Education", then pushes that userData object up to the API using an HTTP PUT. The API then saves that field in the database so future page loads show with the full name field override of "OpenTree Education": (And logging out and logging back in preserves those overrides, as it should.) I’m really happy with the progress we made this week, and the end product is looking closer and closer to the ideal of how we set out initially. Extra thanks to everyone who put in late and early hours to get as much done as possible. While the commits from today did clear up a bunch of tasks, there’s still lots more detail work to be done such as making the full name editable, making the social profiles actually editable (they just look editable right now but they’re not; I just wanted the form controls pre-populated with data from the database), making the bio editable, and tons of styling work. Plus, I was really pushing today and I could have been a lot better about commenting the code I wrote. |
I'm going to say this is out of scope. Great ideas; however, the purpose of the website is mostly to link to a single portfolio site, and it's unlikely users will ever need to add more than one profile of any other type (the database schema doesn't support this right now, and it'd be tricky to modify at this point). But insightful out-of-the-box thinking, @sheacronin and @MahoMori. |
This commit adds a status update at the top of the page that shares with the user the status of their edit submission.
Rename the profile page to UserProfile.tsx to clarify between a "user profile" and a "social profile."
Now that #356 has reached pull request status, incorporate those changes here so that we ensure the automated API tests are passing.
Daily update: no forward progress was made on this ticket, but I did bring the branch up to date with the latest from #356 which now causes all automated tests on code for the repository to be updated. I did have to revert a commit from the #356 branch because it affected files in the webapp/ subdirectory. I'll have to manually incorporate those changes here to preserve the work that was done by the mentees. |
The full name swaps out for a text field, the social profiles get shoved inside a form group, and the bio field becomes editable.
This version now shows an editing form that allows for users to edit every field of their profile. Instead of an "add social network"/"remove social network" control, if a user blanks out the "user name" field for a social network, that removes it from the list of social networks. The control that allows a user to change public visibility only shows if there's something in the "user name" field. And there's a "cancel editing" button that restores any changes to the user profile to the version that comes from the API.
Expected behaviour
User can see an edit button beside the fields. When clicked, the field turns from display view to edit view with a save button. User can also press enter to save.
Social media links editing feature will be consolidated through one button beside all the links. When clicked, users can put urls beside social media icons with save button.
Dependent on Issue #346 completion.
Checklist
The text was updated successfully, but these errors were encountered: