This pull request implements a real-time comment section with upvote and downvote functionality using Socket.io. It includes both real-time updates for comments and vote counts (upvotes/downvotes) of both comments and complaints, ensuring instant feedback and communication for all users connected to the system.
Features:
Real-Time Updates:
Comments and votes update instantly across all connected users without requiring page reloads.
Upvote/Downvote Functionality:
Users can upvote or downvote comments, with real-time vote counts visible for each comment.
Technical Details:
Backend:
Integrated Socket.io into the server to handle real-time events for comments and votes.
Persisted vote counts in the database for future reference.
Modified backend routes and controllers to manage upvote/downvote actions.
Frontend:
Updated the UI to display dynamic comment and vote counts using React.
Added real-time comment and vote handling in src/services/socket.js.
Introduced upvote/downvote buttons in IndividualComment.js.
Related Issue
Fixes #1 (issue)
Type of change
[x] New feature (non-breaking change which adds functionality)
Motivation and Context
This change allows users to engage with the comment section in real time, providing immediate feedback through upvotes and downvotes. It also enhances user interaction by broadcasting changes instantly to all connected clients, improving the user experience.
How Has This Been Tested?
The changes were tested across multiple users connected simultaneously:
Verified that comments and vote counts update in real-time for all connected users.
Ensured persistence of vote counts after refreshing the page.
Tested upvote/downvote actions across different comments and confirmed real-time broadcasting via Socket.io.
Description
This pull request implements a real-time comment section with upvote and downvote functionality using Socket.io. It includes both real-time updates for comments and vote counts (upvotes/downvotes) of both comments and complaints, ensuring instant feedback and communication for all users connected to the system.
Features:
Real-Time Updates:
Comments and votes update instantly across all connected users without requiring page reloads.
Upvote/Downvote Functionality:
Users can upvote or downvote comments, with real-time vote counts visible for each comment.
Technical Details:
Backend:
Frontend:
src/services/socket.js
.IndividualComment.js
.Related Issue
Fixes #1 (issue)
Type of change
Motivation and Context
This change allows users to engage with the comment section in real time, providing immediate feedback through upvotes and downvotes. It also enhances user interaction by broadcasting changes instantly to all connected clients, improving the user experience.
How Has This Been Tested?
The changes were tested across multiple users connected simultaneously:
Screenshots/Demonstration:
Real-time complaint upvote/downvote
https://github.com/user-attachments/assets/4fe0df15-5a16-4849-9819-40fb9b2c8028
Real-time comment and upvote/downvote
https://github.com/user-attachments/assets/e9cd8269-3aa1-4d0d-a404-8439dea1a9d4
New comment upvote/downvote buttons
Checklist:
Test Configuration: