feat: implement invoice co-creator real-time presence indicators#456
Open
Barbie-Dev wants to merge 4 commits into
Open
feat: implement invoice co-creator real-time presence indicators#456Barbie-Dev wants to merge 4 commits into
Barbie-Dev wants to merge 4 commits into
Conversation
… component - Add presence type definitions for tracking co-creator real-time status - Implement useInvoicePresence hook for managing presence lifecycle with 5s heartbeats - Create PresenceBar component with avatar pills and overflow handling for 6+ users - Add section focus tracking (details, payments, recipients) - Implement hover tooltips showing user name and focused section
- Create /api/presence/[invoiceId] dynamic route handler - Implement GET endpoint to retrieve active co-creator roster - Implement POST endpoint to accept and update heartbeats - Add automatic cleanup of inactive users after 10 seconds - Add permission verification for co-creator access (403 if unauthorized) - Store presence data with timestamps and focused sections
…s tracking - Implement InvoiceSection wrapper component for tracking viewport visibility - Use IntersectionObserver to detect when sections enter/exit viewport - Trigger onFocusChange callback when section becomes 30%+ visible - Enable real-time tracking of which invoice section user is viewing - Support for details, payments, and recipients sections
- Add useInvoicePresence hook integration for real-time presence tracking - Display PresenceBar component showing active co-creators - Wrap invoice sections (details, payments, recipients) with InvoiceSection for focus tracking - Update component structure to track which section users are viewing - Implement automatic section focus detection via IntersectionObserver - Fix React hooks eslint issues in PresenceBar component
|
@Barbie-Dev is attempting to deploy a commit to the kingsman-99's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Barbie-Dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implement real-time presence indicators for invoice co-creators, enabling users to see who else is viewing/editing an invoice and which sections they're currently focused on.
Changes Made
New Files Created
src/types/presence.ts - Type definitions for presence system
InvoiceSectionFocus: Enum for tracking viewed sections (details, payments, recipients)PresenceHeartbeat: Data sent to server on each heartbeat (user ID, name, focused section)CoCreatorPresence: Complete presence state including timestamps and last seen dataPresenceRosterUpdate: Server response containing active user rostersrc/hooks/useInvoicePresence.ts - Custom React hook for presence management
/api/presence/[invoiceId]src/components/PresenceBar.tsx - UI component displaying active co-creators
src/components/InvoiceSection.tsx - Wrapper for automatic focus detection
src/app/api/presence/[invoiceId]/route.ts - Backend presence management
Modified Files
useInvoicePresencehook with user identificationPresenceBarcomponent to display active co-creatorsInvoiceSectionfor focus tracking:Features Implemented
Real-Time Presence Tracking
User Interface
Section Focus Detection
Technical Details
Architecture
API Design
React Best Practices
Testing
Manual Testing Scenarios
Build Status
✅ TypeScript compilation successful
✅ ESLint validation passed
✅ Next.js build successful
✅ No runtime errors
Production Considerations
Closes #431