Skip to content

Reactions Sprint 2b - Add Post Reactions System: Display, Count, API, and UI Enhancements#48

Open
gao-yuhan wants to merge 3 commits into
mainfrom
reactions-sprin2-doris
Open

Reactions Sprint 2b - Add Post Reactions System: Display, Count, API, and UI Enhancements#48
gao-yuhan wants to merge 3 commits into
mainfrom
reactions-sprin2-doris

Conversation

@gao-yuhan
Copy link
Copy Markdown

Context:
Worked on issue #21 #22 #46 #47 ** This PR introduces a post reactions system, allowing users to react to posts, view reaction counts, and toggle reactions dynamically. The implementation includes front-end UI enhancements, API endpoints, and database updates to store and manage reactions.

Codebase changes:
node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl : Updated composer formatting to support reaction UI elements. Ensured compatibility with the reaction feature in the post editor.
nodebb-theme-harmony/scss/topic.scss: Added styles for reaction buttons, including hover effects and active states. Adjusted post layout to accommodate reactions while maintaining readability.
nodebb-theme-harmony/templates/account/posts.tpl: Added support for displaying reactions in the user's account post history.
nodebb-theme-harmony/templates/partials/topic/post.tpl: Integrated reaction buttons into the post action section. Displays existing reactions and allows users to react to posts.
nodebb-theme-harmony/templates/partials/topic/reactions.tpl: Created a reusable component for displaying post reactions.
Supports multiple reaction types and reaction counts.
public/src/client/topic/posts.js: Added event listeners to handle user reactions. Updated post rendering logic to dynamically display reactions.
public/src/modules/api.js: Implemented a new API function (postReaction) to handle reaction requests.Sends reaction data to the backend via an AJAX request.
src/api/posts.js: Added new API endpoints: react, unreact, getReactions
src/routes/api.js: Defined new API routes for handling post reactions. Connected frontend actions to backend reaction handling.
src/socket.io/helpers.js: Implemented WebSocket events to update reactions in real time. Ensured reactions update across multiple users without refreshing the page.

Issue: the button does not show up after changing the functions.

@gao-yuhan gao-yuhan self-assigned this Feb 28, 2025
@gao-yuhan gao-yuhan requested a review from yukiiii04 February 28, 2025 03:36
@gao-yuhan gao-yuhan assigned lynzhlang and unassigned lynzhlang Feb 28, 2025
Comment thread nodebb-theme-harmony/templates/partials/topic/reactions.tpl
Copy link
Copy Markdown
Contributor

@yukiiii04 yukiiii04 left a comment

Choose a reason for hiding this comment

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

I think the logic itself looks good, next steps would be to changing other related files because this is just the "main components" and flow of the logic, but the data itself needs to be changed and more variables needed to be declared. Right now, there also isn't any actions linked to the button itself, mainly because you haven't really looked at events.js, topics/posts/votes (similar to what we're doing), and many more. Feel free to refer to the doc @lynzhlang and I made that looked more at upvote/downvote (which I believe is more similar to our issue): https://docs.google.com/document/d/19IliLN_3vqqb-hlR2MCBgwjhhXwsxUy8r6mByMTBIhs/edit?tab=t.f0tnle1jht7j

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants