WIP Favorites card#594
Conversation
|
[diff-counting] Significant lines: 124. |
|
Can we modify this PR to merge into Desmond’s branch instead of master? It might help show the actual changes of the PR instead of bundling all of Desmond’s changes with it. |
|
I modified the merge target to |
benkoppe
left a comment
There was a problem hiding this comment.
I like that you avoid touching the backend schemas too much, since this feature might definitely be blocked behind #598. Until then, things look pretty good, and introduction of a new state makes sense. It might need renaming, though, and we might want to double-check to make sure it always matches the server side.
| const ride = editedRide!; | ||
| const temporalType = getTemporalType(ride); | ||
| const showRecurrence = userRole !== 'driver'; // Hide recurrence for drivers | ||
| const [isClicked, setIsClicked] = useState(false); |
There was a problem hiding this comment.
You might want a more descriptive variable name here than isClicked, something more descriptive about what the state represents.
| const handleFavorite = async () => { | ||
| if (!isClicked) { | ||
| //user favorited icon | ||
| setIsClicked(true); |
There was a problem hiding this comment.
This function might have a mismatched state between isClicked and the actual result of the favoriting operation because of the catch statements below.
Summary
This is a WIP for favoriting and un-favoriting rides. Don't merge. The CSS is implemented as well as a few backend axios changes. Currently, however, a 500 internal server error appears when the user attempts to add a favorite. I believe there might be a mismatch between the provided ride/user keys or the database schema
This pull request is the first step towards implementing a favorites section
Test Plan
Notes
It would be nice to implement the ability to edit a favorited ride, as right now you
can only favorite past rides (if there is one part of the past ride you'd like to change you'd have
to create a new ride then favorite it)