Conversation
Need to style, test. Also if major is being overwritten b/c a user was logged out, add a confirmation modal
Also got rid of a console log lol
|
[diff-counting] Significant lines: 293. |
leihelen
left a comment
There was a problem hiding this comment.
This looks really good and will be a really important feature since a lot of people are turned away from posting reviews because there are so many steps to complete so this will help simplify the process! I tested the same scenarios you went through and it works well on my end as well. Maybe you could add some try catch statements when you call the api and make post requests in case of unexpected errors as well.
qiandrewj
left a comment
There was a problem hiding this comment.
Hi Matt, thank you for taking the initiative to do this (much-needed) quality of life update. The backend functions well for me, the only areas where I have some concerns are in the front-end, so let's speak to some designers so that this can become an official feature for CUReviews!
| submitReview, | ||
| professorOptions | ||
| }: Modal) => { | ||
| open, |
There was a problem hiding this comment.
Why is there so much space here lol
| const oldMajors = getMajorsReq.data.majors | ||
| if (oldMajors && review && | ||
| JSON.stringify(oldMajors) !== JSON.stringify(review.major)) { | ||
| toast.info('Your major has been changed ' + |
There was a problem hiding this comment.
I'm receiving some errors with the toast message, where it says "Your major has been changed false ..."
| setValidMajor(JSON.stringify(newSelectedMajors) !== JSON.stringify(userMajors)); | ||
| } | ||
|
|
||
| const getUserMajors = async () => { |
There was a problem hiding this comment.
Similarly to how the other information in UserInfo is passed in as props (so this is almost entirely a frontend/styled component), I think it would be best to retrieve the information upstream, so that all the backend calls are together
| } | ||
| } | ||
|
|
||
| const updateMajors = async () => { |
There was a problem hiding this comment.
This still makes sense to stay in the UserInfo component. However, I do think it needs a redesign because it looks clunky right now as-is
There was a problem hiding this comment.
The toast and frontend update looks smooth tho, the main thing is the button is really large and possibly in an awkward place
|
|
||
| const updateMajors = async () => { | ||
| const response = await axios.post('/api/profiles/set-majors', { netId, majors: selectedMajors }) | ||
| console.log(response) |
There was a problem hiding this comment.
Since this is user-facing, we don't want to have console.logs. In the admin page, we're a bit more lax with it because it's only for our team anyway.
| <div className={styles.netid}>{netId}</div> | ||
| <div> | ||
| <div className={styles.netid}> | ||
| <span className={styles.bold}>{netId}</span> |
There was a problem hiding this comment.
I really like this new feature - looks clean too!
| updateStudentReviews, | ||
| updateReviewLikes, | ||
| hideReportedReview | ||
| hideReportedReview, updateStudentMajors |
| getStudentMajors, | ||
| getStudentReviewDocs, | ||
| getTotalLikesByNetId | ||
| getTotalLikesByNetId, setStudentMajors |
Summary
This PR works on a major update... haha i'm so funny...... anyway it allows users to set their major as a part of their account rather than each review individually (although reviews stay attached to the major selected at the time of publication).
New users are prompted to select their major on the review page with the same UI as before, but their selection will then attach to their account. Users shouldn't be shown the major selection dropdown otherwise as long as they continue to have a selected major and are logged in. Existing users can update their major on the profile page, where there's a dropdown menu to do so.
PR Type
Mobile + Desktop Screenshots & Recordings
https://github.com/user-attachments/assets/88ed0c9b-105f-4a37-a8fc-bf0b5bad2a08

https://github.com/user-attachments/assets/8c0ca687-3eb0-4a21-aa40-6be17db0dfa1
QA - Test Plan
Tested in a variety of different account scenarios, including with accounts that have no major, accounts with many majors, etc. Tested new UIs on mobile, but there isn't a ton that's different. Couldn't test with a new account (b/c I don't have other NetIDs) but I simulated that performance essentially. Also tested to ensure that majors are still correctly tied to reviews.
Breaking Changes & Notes
Added to documentation?
What GIF represents this PR?
gif