You are expected to focus on the core requirements. Bonus features are optional and may be partially implemented if time allows.
Build a real-time collaboration dashboard that synchronizes user activity across multiple browser tabs using the
react-broadcast-sync library.
- Create a new React project using any setup you prefer (e.g., Vite, CRA, Next.js)
- Install the required package:
npm install react-broadcast-sync
- Use any styling approach (CSS, Tailwind, MUI, etc.)
Create a custom hook called useCollaborativeSession that:
- Sets up the broadcast channel
- Manages internal state for users, chat, counter
- Exposes state and actions:
users,messages,countersendMessage(),updateCounter(),markTyping(), etc.
- Internally uses
react-broadcast-syncto handle cross-tab communication
- Detect and display active users (based on tabs)
- Show a user list with:
- Username or ID (you can generate random names if needed)
- Last activity timestamp
- Detect and visually indicate when a user joins or leaves
- Counter that stays synchronized across all tabs
- Any user can increment/decrement the value
- Show which user performed the last action
- Display timestamp of last action
- Text area for message writing
- Show typing indicators when users are actively typing
- Synchronize conversation content across all tabs
- For each message display which user sent it and its timestamp
- Allow users to delete their own messages from the chat with syncing across tabs
- Allow users to send a messages with expiration
- Use proper error handling and cleanup
- Use TypeScript or well-typed PropTypes
- Abstract logic into reusable components/hooks
- Keep the code modular, readable, and clean
- Synchronize existing state on page load (rehydrate from current messages/users)
- Theme sync across tabs (light/dark mode)
- Include debouncing for frequent updates
- Implement loading states
- Add responsive layout
- Activity feed showing recent actions
- User avatar system
- Focus/cursor position indicators
- Complete source code
- README with setup instructions and implementation notes
- Working demo (open multiple tabs to test)
- Proper use and integration of
react-broadcast-sync - Correct and clean custom hook abstraction
- Working real-time sync across tabs
- Well-structured and maintainable code
- Functional and user-friendly UI
- Handling of edge cases (e.g., expired messages, tab close)
- Bonus points for creative features, polish, or great UX