Skip to content

Comments

Integrate team creation into registration flow with URL-based referral links#11

Merged
ManasMalla merged 4 commits intofeature/referral-code-team-registrationfrom
copilot/sub-pr-10
Dec 29, 2025
Merged

Integrate team creation into registration flow with URL-based referral links#11
ManasMalla merged 4 commits intofeature/referral-code-team-registrationfrom
copilot/sub-pr-10

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Team creation now happens inline during registration. Referral links (/register?referral=ABC123) replace manual code entry—clicking auto-fills and locks the code field.

Changes

Registration Page

  • Inline team creation form when "Yes, I'll create a team" selected
    • Team name input with validation (3-50 chars, uniqueness check)
    • Generates 6-char alphanumeric code with collision detection
  • URL parameter handling via useSearchParams
    • Auto-fills referral code from query param
    • Disables input field and auto-selects "join team" radio
    • Visual feedback (checkmark + message)
  • Success modal with shareable link
    • Displays full URL: ${origin}/register?referral=${code}
    • Share button (Web Share API + clipboard fallback)
    • Copy button for code only

Code Example

// URL parameter detection
useEffect(() => {
  const urlReferralCode = searchParams.get("referral");
  if (urlReferralCode) {
    setReferralCode(urlReferralCode.toUpperCase());
    setIsTeamLead(false); // Auto-select member mode
  }
}, [searchParams]);

// Improved code generation (guaranteed length)
const generateReferralCode = () => {
  let code = "";
  while (code.length < 6) {
    code += Math.random().toString(36).substring(2);
  }
  return code.substring(0, 6).toUpperCase();
};

Create Team Page

  • Deprecated to redirect stub
  • Maintained for backward compatibility with existing links

Input Validation

  • Alphanumeric-only filter on manual code entry
  • Uniqueness check with retry logic (max 10 attempts)
  • SSR-safe URL construction helper

Flow Changes

Before: Register → Redirect to /create-team → Get code → Share code manually → Member types code
After: Register with inline form → Get link → Member clicks link → Auto-join


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 29, 2025
Copilot AI and others added 3 commits December 29, 2025 15:48
Co-authored-by: ManasMalla <38750492+ManasMalla@users.noreply.github.com>
Co-authored-by: ManasMalla <38750492+ManasMalla@users.noreply.github.com>
…R safety

Co-authored-by: ManasMalla <38750492+ManasMalla@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 29, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI changed the title [WIP] Add simplified team registration with referral codes Integrate team creation into registration flow with URL-based referral links Dec 29, 2025
Copilot AI requested a review from ManasMalla December 29, 2025 15:55
Copy link
Contributor

@ManasMalla ManasMalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG;TM

@ManasMalla ManasMalla marked this pull request as ready for review December 29, 2025 16:00
@ManasMalla ManasMalla merged commit 3074ed6 into feature/referral-code-team-registration Dec 29, 2025
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.

2 participants