Skip to content

feat: add invite members modal with copy to clipboard#202

Closed
dotmantissa wants to merge 1 commit into
Lumina-eX:mainfrom
dotmantissa:feat/invite-members
Closed

feat: add invite members modal with copy to clipboard#202
dotmantissa wants to merge 1 commit into
Lumina-eX:mainfrom
dotmantissa:feat/invite-members

Conversation

@dotmantissa

Copy link
Copy Markdown
Contributor

📌 Pull Request

🔗 Related Issue

Closes #181


📝 Description

  • Adds a user-friendly Invite Members modal accessible directly from the chat room header, giving group members a one-click way to generate and share invite codes.
  • Previously, there was no UI surface for generating invite codes even though the backend endpoint (POST /api/groups/[id]/invite) already existed. This PR wires the frontend to that endpoint and delivers the copy-to-clipboard experience described in the issue.

🚀 Changes Made

  • Feature implemented: Invite Members modal with invite code generation and copy-to-clipboard
  • Bug fixed:
  • Refactor:
  • Documentation updated:

New files:

  • components/invite-members-modal.tsx — self-contained Radix Dialog component with a trigger button, invite code generation, copy button, success/error feedback, and a regenerate option

Modified files:

  • app/chat/page.tsx — imports InviteMembersModal and renders it in the chat room header alongside the existing Audit and Members buttons

🧪 Testing & Validation

  • Tested locally
  • No runtime errors
  • Existing features work as expected
  • Edge cases handled

Validated:

  • Modal opens and immediately generates a code via POST /api/groups/[id]/invite
  • Spinner shown while code is being fetched
  • Invite code displayed in a selectable monospace block
  • Copy button writes to clipboard and fires a success toast ("Invite code copied to clipboard!")
  • Copy button transitions to a green "Copied!" state for 2.5 s then resets
  • "Generate a new code" link regenerates without closing the modal
  • API failure shows an error toast and a retry link (no silent failure)
  • Clipboard denial (e.g. insecure context) falls back to an error toast prompting manual copy
  • TypeScript type check (pnpm exec tsc --noEmit) passes with zero errors
  • Layout does not break on mobile — modal has mx-4 on small screens

⚠️ Breaking Changes

  • No breaking changes
  • Breaking changes exist (explain below)

📸 Screenshots (REQUIRED for UI changes)

Before After
Chat header had Audit and Members buttons only Chat header has Audit, Members, and Invite buttons
No UI to generate or share invite codes Clicking Invite opens a modal with the code and a one-click copy button

📋 Contributor Checklist (MANDATORY)

  • I was assigned to this issue
  • My code follows the project structure and conventions
  • I have tested my changes thoroughly
  • I did not introduce unnecessary dependencies
  • I have linked the issue (Closes #181)
  • This PR is ready for review

💡 Notes for Reviewer

  • Key areas to review: components/invite-members-modal.tsx — the modal calls the API on every open (not cached) so each open yields a fresh invite code. This is intentional: it avoids stale/expired codes being presented to the user.
  • Known limitations: The generated codes do not have an expiry by default (the API accepts expires_in but we omit it here for simplicity). If time-limited codes are required, that can be added as a follow-up option in the modal.

Adds an Invite button to the chat header (next to Audit and Members)
that opens a modal for sharing group invite codes.

When the modal opens it immediately calls POST /api/groups/[id]/invite
to generate a fresh UUID invite code, displays it in a monospace block,
and provides a one-click copy button. A success toast confirms the copy.
Users can also regenerate a new code without closing the modal.

Error states (failed generation, clipboard denied) surface as toast
notifications with a retry option so the flow never silently fails.
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@dotmantissa 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! 🚀

Learn more about application limits

@SudiptaPaul-31

Copy link
Copy Markdown
Collaborator

@dotmantissa please resolve conflicts

@SudiptaPaul-31 SudiptaPaul-31 added the wontfix This will not be worked on label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Group Invitation Sharing UI

2 participants