Skip to content

feat: adds join team functionality#144

Merged
yesyash merged 3 commits intodevelopfrom
yash/join-team-link
Jul 19, 2025
Merged

feat: adds join team functionality#144
yesyash merged 3 commits intodevelopfrom
yash/join-team-link

Conversation

@yesyash
Copy link
Contributor

@yesyash yesyash commented Jul 19, 2025

Date: 19 July 2025

Developer Name: yash raj


Issue Ticket Number

  • N/A

Description

  • adds join team by invite code functionality.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

image

Description by Korbit AI

What change is being made?

Add functionality for users to join teams using an invite code and refactor associated components for improved usability in the application.

Why are these changes being made?

This change allows users to join teams using a unique invite code, enhancing team collaboration capabilities. The use of a new joinTeamByInviteCode endpoint, together with a dedicated JoinTeam component, provides a streamlined and user-friendly interface. Additionally, related type definitions and UI components were refactored to better integrate this functionality within the existing application structure.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@yesyash yesyash self-assigned this Jul 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 19, 2025

Caution

Review failed

The pull request is closed.

Summary by CodeRabbit

  • New Features

    • Added the ability for users to join a team using an invite code via a new "Join a team" page and sidebar link.
  • Enhancements

    • Sidebar now includes a "Join a team" link for easier access.
    • Updated landing page and footer to display a new animated logo.
    • Improved button and sidebar styling for a more streamlined appearance.
  • Removals

    • Removed the old teams table from the join teams page in favor of the new invite code flow.
  • Bug Fixes

    • Adjusted type definitions to improve team data handling and compatibility.

Walkthrough

This update introduces a new "Join Team by Invite Code" feature, refactors team API types and methods to use a unified TeamDto, and updates related UI components. It removes the old teams table join UI, adds a new JoinTeam component, and modifies the sidebar and landing page visuals for consistency.

Changes

File(s) Change Summary
api/teams/teams.api.ts, api/teams/teams.type.ts Refactored team API types to use TeamDto; updated API methods' return types; added joinTeamByInviteCode.
modules/teams/join-team.tsx Added new exported JoinTeam React component for joining teams via invite code.
app/(internal-routes)/teams/join/TeamsTable.tsx Removed the TeamsTable component and its UI logic.
app/(internal-routes)/teams/join/page.tsx Replaced local export with the new JoinTeam component.
components/app-sidebar.tsx Added "Join a team" link and updated sidebar header styling.
components/Animated-logo.tsx Reduced logo container size.
components/signin-button.tsx Simplified dashboard launch button; removed icon and animation.
modules/landing-page/landing-dashboard-overview.tsx, modules/landing-page/landing-footer.tsx Replaced Zap icon with StrideAppLogo in dashboard preview and footer.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant JoinTeamComponent
    participant TeamsApi
    participant Server
    participant Router
    participant Toast

    User->>JoinTeamComponent: Enter invite code, submit form
    JoinTeamComponent->>TeamsApi: joinTeamByInviteCode(inviteCode)
    TeamsApi->>Server: POST /v1/teams/join-by-invite
    Server-->>TeamsApi: TeamDto response
    TeamsApi-->>JoinTeamComponent: TeamDto
    JoinTeamComponent->>Toast: Show success or error
    JoinTeamComponent->>Router: Navigate to /teams/{teamId}/todos (on success)
Loading

Possibly related PRs

  • #105: Reverts previous team management features and UI, directly related to the team join and API changes in this PR.
  • #121: Originally introduced the addMembers method, which is refactored in this PR with a new return type and signature.

Suggested labels

feature task

Poem

A hop and a leap, a code to unlock,
Now teams can be joined with a single knock.
The sidebar shines with a brand new link,
While logos shrink and icons blink.
Rabbits rejoice—invite codes in play,
Teamwork made easy, the StrideApp way! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

api/teams/teams.api.ts

Oops! Something went wrong! :(

ESLint: 9.30.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.

app/(internal-routes)/teams/join/page.tsx

Oops! Something went wrong! :(

ESLint: 9.30.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.

api/teams/teams.type.ts

Oops! Something went wrong! :(

ESLint: 9.30.1

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.5_eslint-plugin-import-x@4.16.1_@typescript-eslint+utils@8.36.0_79fa352f41e97200dfc66b7389b5a599/node_modules/eslint-config-next/index.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.

  • 6 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa22dc and a9c514b.

📒 Files selected for processing (10)
  • api/teams/teams.api.ts (3 hunks)
  • api/teams/teams.type.ts (2 hunks)
  • app/(internal-routes)/teams/join/TeamsTable.tsx (0 hunks)
  • app/(internal-routes)/teams/join/page.tsx (1 hunks)
  • components/Animated-logo.tsx (1 hunks)
  • components/app-sidebar.tsx (4 hunks)
  • components/signin-button.tsx (2 hunks)
  • modules/landing-page/landing-dashboard-overview.tsx (2 hunks)
  • modules/landing-page/landing-footer.tsx (2 hunks)
  • modules/teams/join-team.tsx (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yesyash yesyash merged commit 34f4bdd into develop Jul 19, 2025
2 of 4 checks passed
@yesyash yesyash deleted the yash/join-team-link branch July 19, 2025 00:58
@coderabbitai coderabbitai bot added the feature task A big ticket item that needs to come up as a feature label Jul 19, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Excessive Cache Invalidation ▹ view
Security Missing Invite Code Input Validation ▹ view
Functionality Insufficient Invite Code Validation ▹ view
Error Handling Lost Error Context in Mutation Error Handler ▹ view
Security Missing Invite Code Validation ▹ view
Functionality Nullable users array contradicts team requirements ▹ view
Files scanned
File Path Reviewed
app/(internal-routes)/teams/join/page.tsx
components/Animated-logo.tsx
api/teams/teams.type.ts
api/teams/teams.api.ts
modules/landing-page/landing-footer.tsx
modules/teams/join-team.tsx
components/signin-button.tsx
components/app-sidebar.tsx
modules/landing-page/landing-dashboard-overview.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

mutationFn: TeamsApi.joinTeamByInviteCode.fn,
onSuccess: (data) => {
toast.success(`Joined team ${data.name}`)
queryClient.invalidateQueries({ queryKey: TeamsApi.getTeams.key })
Copy link

Choose a reason for hiding this comment

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

Excessive Cache Invalidation category Performance

Tell me more
What is the issue?

Invalidating the entire teams query cache when only a single team was added is inefficient.

Why this matters

This causes unnecessary refetching of all teams data when only the newly joined team needs to be added to the cache.

Suggested change ∙ Feature Preview

Instead of invalidating the entire teams cache, use setQueryData to update the cache with the new team data:

queryClient.setQueryData(TeamsApi.getTeams.key, (old: Team[]) => [...old, data])
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Comment on lines +16 to +37
const [inviteCode, setInviteCode] = useState('')

const joinByInviteCodeMutation = useMutation({
mutationFn: TeamsApi.joinTeamByInviteCode.fn,
onSuccess: (data) => {
toast.success(`Joined team ${data.name}`)
queryClient.invalidateQueries({ queryKey: TeamsApi.getTeams.key })
router.push(`/teams/${data.id}/todos`)
},
onError: () => {
toast.error('Failed to join team, please try again later')
},
})

const handleFormSubmission = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (!inviteCode) {
toast.error('Please enter an invite code')
return
}

joinByInviteCodeMutation.mutate({ inviteCode })
Copy link

Choose a reason for hiding this comment

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

Missing Invite Code Input Validation category Security

Tell me more
What is the issue?

The invite code input is not validated or sanitized before being sent to the API.

Why this matters

Without input validation, malicious users could potentially submit specially crafted invite codes that might lead to injection attacks or other security vulnerabilities on the server side.

Suggested change ∙ Feature Preview
const handleFormSubmission = (e: React.FormEvent<HTMLFormElement>) => {
  e.preventDefault()
  if (!inviteCode) {
    toast.error('Please enter an invite code')
    return
  }
  
  // Add input validation
  if (!/^[a-zA-Z0-9-]{6,}$/.test(inviteCode)) {
    toast.error('Invalid invite code format')
    return
  }

  joinByInviteCodeMutation.mutate({ inviteCode })
}
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Comment on lines +32 to +35
if (!inviteCode) {
toast.error('Please enter an invite code')
return
}
Copy link

Choose a reason for hiding this comment

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

Insufficient Invite Code Validation category Functionality

Tell me more
What is the issue?

The invite code validation only checks if the code is empty but doesn't validate the format or length of the code.

Why this matters

Invalid invite code formats could reach the server unnecessarily, causing failed API calls that could be prevented client-side.

Suggested change ∙ Feature Preview

Add proper validation before submission:

const isValidInviteCode = (code: string) => {
  return code.length === 8 && /^[A-Z0-9]+$/.test(code)  // Adjust pattern as per actual requirements
}

const handleFormSubmission = (e: React.FormEvent<HTMLFormElement>) => {
  e.preventDefault()
  if (!inviteCode) {
    toast.error('Please enter an invite code')
    return
  }
  if (!isValidInviteCode(inviteCode)) {
    toast.error('Please enter a valid invite code')
    return
  }
  joinByInviteCodeMutation.mutate({ inviteCode })
}
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Comment on lines +25 to +27
onError: () => {
toast.error('Failed to join team, please try again later')
},
Copy link

Choose a reason for hiding this comment

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

Lost Error Context in Mutation Error Handler category Error Handling

Tell me more
What is the issue?

The error callback loses the error context by not utilizing the error information provided by the mutation.

Why this matters

Without passing the error details to the toast message, debugging becomes more difficult as developers won't know the specific reason for the failure.

Suggested change ∙ Feature Preview

Include the error information in the error toast for better debugging:

onError: (error: Error) => {
      toast.error(`Failed to join team: ${error.message}`)
    }
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

Comment on lines +46 to +49
fn: async ({ inviteCode }: { inviteCode: string }): Promise<TeamDto> => {
const { data } = await apiClient.post<TeamDto>(`/v1/teams/join-by-invite`, {
invite_code: inviteCode,
})
Copy link

Choose a reason for hiding this comment

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

Missing Invite Code Validation category Security

Tell me more
What is the issue?

The inviteCode parameter is accepted without validation before being sent to the server, potentially allowing malformed or malicious invite codes.

Why this matters

Invalid invite codes could potentially be used for brute force attacks or could contain malicious payloads that might exploit server vulnerabilities.

Suggested change ∙ Feature Preview
// Add input validation for invite code
if (!inviteCode.match(/^[a-zA-Z0-9-_]{8,32}$/)) { // adjust pattern as per actual invite code format
  throw new Error('Invalid invite code format');
}
const { data } = await apiClient.post<TeamDto>(`/v1/teams/join-by-invite`, {
  invite_code: inviteCode,
});
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

| 'created_at'
| 'updated_at'
> & {
users: { id: string; name: string; tasksAssignedCount?: number; addedOn?: string }[] | null
Copy link

Choose a reason for hiding this comment

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

Nullable users array contradicts team requirements category Functionality

Tell me more
What is the issue?

The users array in TeamDto can be null, which doesn't align with the team joining functionality's requirement to always have at least one user (the creator).

Why this matters

Having a null users array could lead to UI errors when displaying team members, as there should always be at least an empty array to represent no additional members beyond the creator.

Suggested change ∙ Feature Preview

Change the users type to be non-nullable with a default empty array:

users: { id: string; name: string; tasksAssignedCount?: number; addedOn?: string }[]
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

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

Labels

feature task A big ticket item that needs to come up as a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant