-
Notifications
You must be signed in to change notification settings - Fork 2
feat(messages): Add real-time typing and user presence indicators #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Implement user presence tracking with `useUserPresence` hook - Add `UserStatusIndicator` component to show online/offline status - Create `TypingIndicator` component to display when users are typing - Integrate typing events with `useTypingIndicator` hook in conversation view - Update `MessageInput` to manage and emit typing events - Add status indicators in conversation list and header - Enhance messaging UI with real-time user interaction signals Improves user experience by providing immediate feedback about user availability and current messaging activity.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThe changes add real-time presence tracking and typing indicators to the messaging system. New hooks manage user presence and typing state via Supabase subscriptions, new components display online status and typing activity, and existing message components integrate these features into direct conversations. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Client
participant Supabase as Supabase<br/>(Presence Table)
rect rgb(200, 220, 240)
Note over User,Supabase: User Presence Tracking
User->>Client: Opens app
activate Client
Client->>Client: useMyPresence() hook mounted
Client->>Supabase: Upsert presence (isOnline: true, timestamp)
Supabase-->>Client: Acknowledgment
Client->>Client: Set interval: update presence every 30s
end
rect rgb(240, 200, 220)
Note over User,Supabase: User Goes Offline
User->>Client: Close app / page hidden
Client->>Supabase: Upsert presence (isOnline: false)
Supabase-->>Client: Acknowledgment
Client->>Client: Cleanup interval & listeners
end
sequenceDiagram
participant User1
participant Client1 as Client 1<br/>(Typer)
participant Supabase as Supabase<br/>(Broadcast)
participant Client2 as Client 2<br/>(Watcher)
participant User2
rect rgb(240, 240, 200)
Note over User1,Supabase: Typing Detection & Broadcast
User1->>Client1: Types in message input
Client1->>Client1: onTyping(true) fired
Client1->>Supabase: Broadcast typing:conversationId<br/>{userId, username, isTyping: true}
end
rect rgb(220, 240, 200)
Note over Client2,Supabase: Typing Indicator Rendering
Supabase->>Client2: Receive typing broadcast event
Client2->>Client2: Update typingUsers list
Client2->>Client2: Render TypingIndicator<br/>with active typers
Client2-->>User2: Display "X is typing..."
end
rect rgb(240, 200, 200)
Note over User1,Client1: Inactivity & Cleanup
Note over User1,Client1: 2s no keystroke
Client1->>Client1: onTyping(false) emitted
Client1->>Supabase: Broadcast typing:conversationId<br/>{userId, username, isTyping: false}
Supabase->>Client2: Receive stop-typing event
Client2->>Client2: Remove user from typingUsers
Client2->>Client2: Hide TypingIndicator
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
useUserPresencehookUserStatusIndicatorcomponent to show online/offline statusTypingIndicatorcomponent to display when users are typinguseTypingIndicatorhook in conversation viewMessageInputto manage and emit typing eventsSummary by CodeRabbit