The Community module provides discussion features for the SkillSync platform, including sharing, pinning, locking, and notifications.
A reusable share button that supports both the native Web Share API and clipboard fallback.
<ShareButton
url="/discussions/1"
title="Discussion Title"
text="Optional description"
/>Behavior:
- Uses
navigator.share()when available (mobile devices, supported browsers) - Falls back to
navigator.clipboard.writeText()on unsupported browsers - Shows visual feedback: "Copied!", "Shared!", or "Failed"
- Falls back to clipboard if user cancels the native share dialog
Toggle button to pin/unpin a discussion to the top of the feed.
<PinButton isPinned={isPinned} onToggle={handleToggle} />Features:
- Visual state change (amber highlight when pinned)
- Accessible:
aria-pressedreflects state - Tooltip changes between "Pin discussion" / "Unpin discussion"
Toggle button to lock/unlock a discussion, preventing new replies.
<LockButton isLocked={isLocked} onToggle={handleToggle} />Features:
- Visual state change (red highlight when locked)
- When locked, reply forms are disabled and a lock message is shown
- Accessible:
aria-pressedreflects state
A bell icon button that displays unread notification count and a dropdown panel.
<NotificationBell />Features:
- Unread count badge
- Dropdown panel with notification list
- "Mark all read" action
- Individual dismiss and mark-read actions
- Closes on outside click
Auto-dismissing toast notifications that appear in the bottom-right corner.
Features:
- Auto-dismiss after 5 seconds
- Color-coded by type (info/success/warning/error)
- Dismiss button on each toast
- Shows up to 5 toasts simultaneously
Card component displaying a single discussion with actions.
Features:
- Displays title, excerpt, author, and replies count
- Shows "Pinned" and "Locked" badges when applicable
- Includes Share button and Like button
Full thread view for a discussion with replies, voting, and moderation controls.
Features:
- Pin/Lock toggle buttons with notification feedback
- Reply form that disables when discussion is locked
- Nested reply tree with collapse/expand
- Reply button hidden on individual replies when locked
Global notification state using React Context + useReducer.
const { notify, markRead, markAllRead, dismiss, notifications, unreadCount } = useNotifications();
// Add a notification
notify("success", "Reply posted", "Your reply has been added.");
notify("warning", "Discussion locked", undefined, 8000); // custom duration
// Mark as read
markRead(notificationId);
// Mark all as read
markAllRead();
// Dismiss a notification
dismiss(notificationId);Community state management with categories, search, and sort. Discussion model now includes isPinned and isLocked fields.
Returns paginated discussions with optional category filter.
Query params: page, pageSize, category
Toggles like state for a discussion.
Updates pin/lock status for a discussion.
Body: { isPinned?: boolean, isLocked?: boolean }
| Type | Color | Icon | Use Case |
|---|---|---|---|
info |
Indigo | Info circle | General information |
success |
Green | Check circle | Successful actions |
warning |
Amber | Warning triangle | Important notices |
error |
Red | X circle | Errors and failures |
- All buttons have descriptive
aria-labelattributes - Toggle buttons use
aria-pressedto communicate state - Notification dropdown is keyboard-navigable
- Toast notifications use
role="alert"for screen readers - Color is never the sole indicator of state (icons + text accompany colors)