Feature: Add article reactions with real-time updates and emoji interactions #18
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.
Implements lightweight, emoji-based reactions for blog articles allowing readers to express engagement through 👍 ❤️ 🔥 💡 reactions. This enhancement provides a simple, fun, and low-friction way for users to interact with content while giving authors valuable feedback on what resonates with their audience.
Key Features
Reaction System: Four distinct emoji reactions (like, love, fire, idea) that users can toggle on/off per article. Each user can have one reaction of each type per article, with real-time count updates visible to all visitors.
Authentication Flow: Anonymous users can view reaction counts but must log in to interact. Clicking a reaction button when not authenticated redirects to the login page with a helpful toast notification.
Real-time Updates: Utilizes Supabase's real-time subscriptions to instantly update reaction counts across all connected clients when users add or remove reactions.
Optimistic UI: Provides immediate visual feedback when users interact with reactions, with automatic rollback if the server request fails.
Technical Implementation
Database Layer:
article_reactionstable with proper indexes and Row Level Security policies(user_id, article_slug, reaction_type)prevents duplicate reactionsService Layer:
ReactionTypeenumUI Component:
ReactionsBarcomponent with mobile-friendly circular buttonsIntegration: Added to article pages alongside existing features like favorites and topics, maintaining the current layout and user experience.
Testing
Added comprehensive unit tests for the reactions service with 16/16 test cases passing. Tests cover reaction CRUD operations, count aggregation, and error handling scenarios.
The implementation follows the repository's established patterns and coding standards, ensuring maintainability and consistency with the existing codebase.
Fixes #17.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.comnode /home/REDACTED/work/DevVerse-SWE-Blog/DevVerse-SWE-Blog/node_modules/.bin/next build(dns block)next-server (v15.1.7)(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.