-
Notifications
You must be signed in to change notification settings - Fork 338
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(dev): Vote components #1488
Conversation
* origin/main: (26 commits) Adding jsit to codeowners. Cleanup, only check for /u/ if /c/ and /m/ checks fail Rename function to be more generic, since it parses users Typescript linter fixes bandaid fix our video embeds Remove pipe from community link regex Add missing classes Use shorter regex in community link parser Move regex pattern to config Update community link markdown parsing Fix avatar alignment issue (LemmyNet#1475) Omit user-scalable to use default Update getHttpBase dependency reference Enable users to zoom on mobile rethink it a bit rethink it a bit add fallback style tag Add community link class prettier Add local community link parser plugin for Markdown-It ...
* origin/main: fix: Add post body preview to desktop post listing view fix: Fix i18n UserService import issue
enableDownvotes?: boolean; | ||
upvoteLoading?: boolean; | ||
downvoteLoading?: boolean; | ||
handleUpvote: (i: PostListing) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we've typically done, is pass the lemmy-js-client form (in this case CreateCommentLike
) up to the parent. Check out post-form.tsx
for an example.
But here, since that could be either a post or a comment, I'd recommend passing up an id, the new vote, and an auth. Type the interface well, something like:
interface VoteItem {
id: number,
newVote: number,
auth: ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- are my latest edits more what you were picturing? I'm not sure where this VoteItem
type could go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments use comment_id
for their ID, and posts use post_id
, so I had to add a switch
and an extra property so comments/posts can specify which type to use when submitting the click.
* origin/main: Fix homepage `scrollTo(0, 0)` failing when document size changes. v0.18.0 v0.18.0-rc.8 Moved `!isBrowser()` check to `FirstLoadServer.isFirstLoad` Fix server-side rendering after first load.
* lemmy/main: fix(a11y): Restore aria-activedescendant chore: Empty commit to re-trigger Woodpecker fix(a11y): Make foreground of 'remove image button' white fix(a11y): Add alt text to emojis form fix(a11y): Fix some a11y markup in Searchable Select component fix(a11y): Change image remove button to true button element fix: Ignore rule for clickaway div; 'Esc' works for this fix: Fix another class fix: Fix some Bootstrap 5 font classes
This PR componentizes the Votes buttons, both "regular" and "compact," in the Post Listing view and Comment Nodes.
Should be tested thoroughly, as voting is a pretty important function.