Skip to content
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

feat: add upvote function #154

Merged
merged 27 commits into from
May 9, 2023
Merged

feat: add upvote function #154

merged 27 commits into from
May 9, 2023

Conversation

huai-jie
Copy link
Contributor

@huai-jie huai-jie commented May 3, 2023

The code is really messy ATM

&

I encountered some issues while attempting to do this

Issues:

  • page required to refresh to get the latest change. (each time you upvote/remove upvote the item, the page is refreshed)
  • upvote change is not synchronized.

Any suggestions on how to improve this are really welcome and appreciated.

@huai-jie huai-jie marked this pull request as draft May 3, 2023 17:18
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I like this. I've been wondering how we'd do this, but this provides a clearer picture and is a great foundation to build upon. I feel like this PR might take a bit of back-and-forth before it's ready, so we'll have to exercise some patience 😅

Either way, the common theme in my suggestions is that we can break up some of the logic of this functionality into smaller, simpler pieces.

utils/db.ts Outdated Show resolved Hide resolved
utils/db.ts Outdated Show resolved Hide resolved
routes/item/[id].tsx Outdated Show resolved Hide resolved
routes/index.tsx Outdated Show resolved Hide resolved
routes/api/vote.ts Show resolved Hide resolved
islands/Vote.tsx Outdated Show resolved Hide resolved
@huai-jie

This comment was marked as off-topic.

@huai-jie huai-jie marked this pull request as ready for review May 5, 2023 03:16
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A step in the right direction! Please don't forget to resolve any comments that you've addressed.

routes/api/vote.ts Outdated Show resolved Hide resolved
islands/VoteBtn.tsx Outdated Show resolved Hide resolved
islands/VoteBtn.tsx Outdated Show resolved Hide resolved
islands/VoteBtn.tsx Outdated Show resolved Hide resolved
islands/VoteBtn.tsx Outdated Show resolved Hide resolved
routes/api/vote.ts Outdated Show resolved Hide resolved
routes/index.tsx Outdated Show resolved Hide resolved
utils/db.ts Outdated Show resolved Hide resolved
utils/db.ts Outdated Show resolved Hide resolved
islands/VoteBtn.tsx Outdated Show resolved Hide resolved
@iuioiua
Copy link
Contributor

iuioiua commented May 8, 2023

The CI error appears to be unrelated to this change.

Also, can you please change the name of VoteBtn to VoteButton to align it with other component names?

@huai-jie huai-jie marked this pull request as draft May 8, 2023 04:49
@huai-jie huai-jie marked this pull request as ready for review May 8, 2023 07:39
routes/api/vote.ts Outdated Show resolved Hide resolved
routes/api/vote.ts Outdated Show resolved Hide resolved
routes/api/vote.ts Outdated Show resolved Hide resolved
routes/index.tsx Outdated Show resolved Hide resolved
components/ItemSummary.tsx Outdated Show resolved Hide resolved
components/ItemSummary.tsx Outdated Show resolved Hide resolved
islands/VoteButton.tsx Outdated Show resolved Hide resolved
islands/VoteButton.tsx Show resolved Hide resolved
routes/item/[id].tsx Outdated Show resolved Hide resolved
utils/db.ts Outdated Show resolved Hide resolved
huai-jie and others added 5 commits May 8, 2023 18:50
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
@iuioiua
Copy link
Contributor

iuioiua commented May 8, 2023

@huai-jie, I've made a few improvements. PTAL and test. WDYT?

@huai-jie
Copy link
Contributor Author

huai-jie commented May 9, 2023

LGTM!

@iuioiua iuioiua merged commit 762420a into denoland:main May 9, 2023
@iuioiua
Copy link
Contributor

iuioiua commented May 9, 2023

Thank you for all your work, @huai-jie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants