Overview
The Discussion component provides a full-featured comment system for collaborative discussions on Insights and Resources. It supports markdown formatting, @mentions, file attachments, emoji reactions, voting, and comprehensive moderation tools.
Key Features
Examples
Threaded Mode
Comments with single-level nested replies. Click "Show replies" to expand reply threads. Try adding a new comment or replying to existing ones.
Discussion(3)
The app crashes when rotating from portrait to landscape
I can confirm this happens specifically on iPhone 15 Pro Max.
automaticallyAdjustsScrollViewInsets = false seems to help.Flat Thread Mode
Comments displayed in a single-level list without reply nesting. Useful for simpler discussions or when replies are not needed.
Discussion(3)
The app crashes when rotating from portrait to landscape
I can confirm this happens specifically on iPhone 15 Pro Max.
automaticallyAdjustsScrollViewInsets = false seems to help.Locked Thread
When a thread is locked, only admins (Owners/Builders) can add new comments. Existing comments remain visible to all users.
Discussion(3)
The app crashes when rotating from portrait to landscape
I can confirm this happens specifically on iPhone 15 Pro Max.
automaticallyAdjustsScrollViewInsets = false seems to help.Admin Features
Admins can pin comments (shown first), mark as resolved, and hide inappropriate content. Hidden comments show a placeholder to non-admins. Try the dropdown menu on any comment to see admin actions.
Discussion(4)
The app crashes when rotating from portrait to landscape
I can confirm this happens specifically on iPhone 15 Pro Max.
automaticallyAdjustsScrollViewInsets = false seems to help.Participant View
A realistic thread from a participant's perspective. Beta testers discussing bugs, sharing discoveries, and helping each other - no admin posts. This demonstrates typical organic community discussion.
Discussion(3)
Steps to reproduce:
1. Add item to cart
2. Go to checkout
3. Fill in payment details
4. Tap "Pay Now" button
First tap does nothing, second tap works.
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
entityType | "INSIGHT" | "RESOURCE" | required | Type of entity the discussion is attached to |
entityId | string | required | ID of the entity |
currentUser | CurrentUser | required | Current user context with id, name, image, and role |
mentionSuggestions | MentionSuggestion[] | [] | Users available for @mention autocomplete |
demoMode | boolean | false | Enable demo mode (no API calls, local state only) |
demoData | {discussions, settings} | undefined | Mock data for demo mode |
Usage
import { Discussion } from '@/ui/components';
// Basic usage with API integration
<Discussion
entityType="INSIGHT"
entityId="insight-123"
currentUser={{
id: 'user-1',
name: 'John Doe',
image: null,
role: 'OWNER'
}}
/>
// Demo mode (for prototypes)
<Discussion
entityType="INSIGHT"
entityId="insight-123"
currentUser={currentUser}
demoMode
demoData={{
discussions: mockDiscussions,
settings: { threadingMode: 'THREADED', isLocked: false, downvoteThreshold: 5 }
}}
/>