Overview
The forum system supports emoji reactions on posts, allowing users to express their feelings and engagement without writing a full reply. The system also includes topic upvoting for content curation.Emoji Reactions
Default Emoji Set
The system provides these default emojis: 👍 🔥 🤔 👀 🎉 ❤️ 👏 😄 🤝Using the EmojiReactions Component
src/components/Forum/EmojiReactions.tsx
Component Features
Real-time Updates
Real-time Updates
The component uses optimistic UI updates with server sync:
Unicode Normalization
Unicode Normalization
Emojis are normalized to NFC form for consistent storage:This handles complex emojis with skin tones and ZWJ sequences.
User Reaction Tracking
User Reaction Tracking
The system tracks which users reacted with which emojis:
Server Actions
Add Reaction
src/lib/actions/forum/reactions.ts
Remove Reaction
src/lib/actions/forum/reactions.ts
Topic Upvoting
Topics can be upvoted to show support and help surface quality content.Implementation
Upvotes are stored as votes on the first post of a topic:Upvote a Topic
src/lib/actions/forum/topics.ts
Remove Upvote
Get Upvote Count
React Hook Integration
src/hooks/useForum.ts
Voting Power Requirements
Insufficient VP Modal
Display a helpful modal when users lack voting power:src/components/Forum/InsufficientVPModal.tsx
Database Schema
Best Practices
Normalize emoji inputs
Normalize emoji inputs
Always normalize emoji to NFC form to ensure consistent storage and matching.
Use optimistic updates
Use optimistic updates
Update UI immediately and revert on error for better UX.
Make operations idempotent
Make operations idempotent
Use upsert for adding reactions so duplicate requests don’t cause errors.
Verify signatures
Verify signatures
Always verify wallet signatures before modifying reaction data.
Check voting power
Check voting power
Verify users have sufficient VP before allowing reactions (unless they have RBAC permissions).
Next Steps
Topics & Posts
Learn about creating topics and posts
Moderation
Set up content moderation and admin tools