Skip to content

feat: add collaborative study group rooms with username-based invitat…#476

Open
Ishta-P-Jain wants to merge 1 commit into
ItsVikasA:mainfrom
Ishta-P-Jain:feat/study-rooms
Open

feat: add collaborative study group rooms with username-based invitat…#476
Ishta-P-Jain wants to merge 1 commit into
ItsVikasA:mainfrom
Ishta-P-Jain:feat/study-rooms

Conversation

@Ishta-P-Jain

Copy link
Copy Markdown

Which issue does this PR close?

Closes #386

Rationale for this change

InnoVision currently focuses on individual learning. Peer-to-peer learning significantly improves engagement, motivation, and knowledge retention. This PR adds a collaborative study room feature so learners can study, discuss doubts, and learn together in real time.

What changes are included in this PR?

New files

  • src/app/study-rooms/page.jsx — Main study rooms page with room sidebar, chat area, create room modal, and invite accept/decline banner
  • src/app/api/rooms/create/route.js — API route to create a new study room
  • src/app/api/rooms/invite/route.js — API route to invite a user by username
  • src/app/api/rooms/join/route.js — API route to accept an invite and join a room
  • src/components/study-rooms/RoomList.jsx — Real-time sidebar list of rooms the user belongs to
  • src/components/study-rooms/ChatWindow.jsx — Real-time chat inside a room using Firebase onSnapshot
  • src/components/study-rooms/InviteModal.jsx — Modal to invite a friend by username with helpful hint about username format

Modified files

  • src/contexts/auth.js — Added username field (email prefix) when saving new users to Firestore
  • src/contexts/notifications.js — Added real-time Firestore listener for pending invitations so they appear in the existing notification bell instantly
  • src/components/Navbar/Navbar.jsx — Added Study Rooms icon (Users) to the navigation bar

Feature flow

  1. User creates a study room via the + button in the sidebar
  2. User invites a friend by typing their username (the part before @gmail.com in their email)
  3. Invited user sees a notification in the bell icon immediately (real-time)
  4. Clicking the notification opens /study-rooms?invite=ID where an Accept & Join / Decline banner appears
  5. On accepting, the user is added to the room and the chat opens automatically
  6. All chat messages update in real time using Firebase onSnapshot

Are these changes tested?

Manually tested the following:

  • Creating a room
  • Inviting a user by username (valid and invalid usernames)
  • Receiving invite notification in real time on the invited user's screen
  • Accepting the invite and being automatically added to the room chat
  • Declining the invite
  • Real-time chat messages between two users in the same room
  • XP awarded (15 XP) on first message sent in a room
  • Study Rooms icon visible and active in navbar on desktop and mobile

No automated tests included as the feature relies heavily on Firebase real-time listeners and UI interactions. Existing tests are not affected.

Are there any user-facing changes?

Yes:

  • New /study-rooms page accessible from the navbar (Users icon)
  • New notification type in the bell for study room invites
  • Existing users will need a username field added to their Firestore user document manually (value = part of email before @). New sign-ups get this automatically.
  • firestore.rules not included in this PR — the following rules need to be added to the project's Firestore rules by a maintainer:
Screenshot 2026-06-05 071253 Screenshot 2026-06-05 070750 Screenshot 2026-06-05 070803 Screenshot 2026-06-05 071147 Screenshot 2026-06-05 070653

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

@Ishta-P-Jain is attempting to deploy a commit to the Vikas' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add Collaborative Study Group Rooms with Username-Based Invitations

1 participant