feat(app): Add guide vote functionality on guide page - #210
Draft
kevin8999 wants to merge 31 commits into
Draft
Conversation
…tion This refactor makes `toggleVote()` easier to understand. The submitted vote will later be used to update the database. Signed-off-by: Kevin Duong <kevin.duong306@gmail.com>
Adds function to fetch variant ID from
`GET /guides/{slug}/{variantSlug}`
This function only works in development environments because it relies on an `.env` variable.
Signed-off-by: Kevin Duong <kevin.duong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
This commit adds several changes - Users can upvote. Upvotes will be saved to the `votes` table - `getAuthToken()` function that returns the user session token TODO: Add user error popups (see changes for details) Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Contributor
Author
|
Upvotes currently work. I still need to implement the following:
|
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
NOTE: `modal={true}` is required in `combobox.tsx`. Without it,
scrolling would not be possible
TODO: Update database after a reason and note is added
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
kevin8999
commented
Aug 5, 2026
This is a large commit adds the following changes: - Splits `toggleVote()` into `toggleVote()` (UI logic) and `submitVote()` (submits vote to backend) - Uploads reason and note to backend after downvote submission - Deselects downvote when closing out of dialog Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Contributor
Author
|
The video below shows the guide vote functionality. My changes should work as intended now. Please let me know if you have any issues 😁! The only things I am going to add from this point forward are refactors to make the code easier to read. 79058922-4f3c-43b6-bc62-843f4c6209c6.webm |
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
WIP: when user presses downvote after it is already selected, pressing it again will "de-select" it. This still needs to be fixed Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
`GET /variants/:id/vote` will return the user's vote if a user ID is specified Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
`GET /variants/:id/vote` will return the user's vote if a user ID is specified Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
This commit forces the downvote to be selected at all times until the user cancels or deletes their vote from the database Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
andyrodrigues30
requested changes
Aug 8, 2026
| }; | ||
| } | ||
|
|
||
| function DownvoteDialog({ isOpen, setIsOpen, setVote, vote }) { |
Collaborator
There was a problem hiding this comment.
rename to DownvoteModal and move to separate file DownvoteModal.tsx under @/components/modals/DownvoteModal.tsx.
Also change to an export arrow function see GuideSubmitModal.tsx as an example.
This commit also replaces `toggleVote()` with `setVote()`. This change may need to be reverted in the future Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
kevin8999
marked this pull request as draft
August 9, 2026 21:09
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
`API_BASE` is also moved outside its function Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
Signed-off-by: Kevin Duong <kevinduong306@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #175.
This PR lets users upvote and downvote guides. If the user downvotes, a popup will ask them for why they downvoted the guide.
Type of change
Verification
pnpm -r typecheckpassespnpm -r buildpasses