Skip to content

more visible invite team members#932

Merged
BilalG1 merged 9 commits intodevfrom
more-visible-invite-members
Oct 15, 2025
Merged

more visible invite team members#932
BilalG1 merged 9 commits intodevfrom
more-visible-invite-members

Conversation

@BilalG1
Copy link
Contributor

@BilalG1 BilalG1 commented Oct 7, 2025

Screenshot 2025-10-10 at 2 27 00 PM (PAST) Screenshot 2025-10-07 at 1 54 00 PM

High-level PR Summary

This PR improves the visibility and usability of the team member invitation feature by replacing a small icon button with a more prominent button labeled "Invite Teammate", reorganizing the team header layout to better position the invite button, and making the invite functionality more robust by fetching user and admin data asynchronously instead of using hooks.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx

Need help? Join our Discord

Analyze latest changes


Important

Enhances team member invitation UI and refactors data fetching in page-client.tsx for better usability and robustness.

  • UI Enhancements:
    • Replaced icon-only invite button with a ghost button labeled "Invite Teammate" in page-client.tsx.
    • Reorganized team header layout to better position the invite button.
  • Data Fetching:
    • Updated TeamAddUserDialog to fetch user and admin data asynchronously instead of using hooks.
    • Validates admin limits at submission time in TeamAddUserDialog.
  • Misc:
    • Dialog title now reflects the team's display name in TeamAddUserDialog.

This description was created by Ellipsis for 3e16f0c. You can customize this summary. It will automatically update as commits are pushed.


Summary by CodeRabbit

  • Refactor

    • Projects are now grouped by team with readable team labels and a “No Team” fallback; each team shows its own project grid.
    • The “Add User” dialog is available next to each team and shows the team’s display name in the title.
  • Style

    • Replaced icon-only trigger with a ghost button using a settings icon and improved accessibility.
  • Chores

    • Invite submission now validates current admin limits at submit time.

@vercel
Copy link

vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stack-backend Ready Ready Preview Comment Oct 15, 2025 11:40am
stack-dashboard Ready Ready Preview Comment Oct 15, 2025 11:40am
stack-demo Ready Ready Preview Comment Oct 15, 2025 11:40am
stack-docs Ready Ready Preview Comment Oct 15, 2025 11:40am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Reworked per-team projects layout and moved the TeamAddUserDialog trigger beside each team label; dialog now fetches listUsers and dashboard_admins at submit time to validate admin limits and either create a checkout URL (redirect) or send an invite.

Changes

Cohort / File(s) Summary
Projects page UI & invite dialog
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
- Compute and display team label (with "No Team" fallback) and render projects nested per computed team container
- Move TeamAddUserDialog trigger next to team label; remove Suspense wrapper and replace icon-only trigger with a ghost/settings button (accessibility attrs)
- Dialog title includes team display name
- On submit, dialog fetches listUsers(teamId) and getItem("dashboard_admins") at runtime and validates admins.quantity; if limit reached create checkout URL and redirect, else send invite and show success toast

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant ProjectsPage
  participant Dialog as TeamAddUserDialog
  participant API as listUsers / getItem
  participant Billing as Checkout
  participant Toast as UI_Toast

  User->>ProjectsPage: View projects grouped by computed team label
  ProjectsPage->>Dialog: Render trigger beside team label
  User->>Dialog: Open dialog and submit invite

  rect rgba(220,235,255,0.35)
    Dialog->>API: listUsers(teamId)
    Dialog->>API: getItem("dashboard_admins")
    API-->>Dialog: users, admins.quantity

    alt admins.quantity reached
      Dialog->>Billing: create checkout URL
      Billing-->>Dialog: checkout URL
      Dialog->>User: Redirect to checkout
    else under limit
      Dialog->>API: send invite / add teammate
      API-->>Dialog: success
      Dialog->>Toast: show success message
    end
  end

  note right of Dialog: Validation uses fetched `admins.quantity` during submit
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • N2D4

Poem

I twitch my whiskers, reshape the team,
I tuck the invite where the label gleams.
I count the admins, then steer the flow—
Redirect or welcome, onward we go.
Carrots and tabs, hop in—let’s grow! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly highlights the primary change—making the team member invitation feature more visible—and directly reflects the main UI update without extraneous detail.
Description Check ✅ Passed The description includes the required contributing guidelines comment, embeds before-and-after screenshots, and provides a clear high-level summary of UI and data-fetching changes along with estimated review time, fulfilling the repository template and giving reviewers ample context.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch more-visible-invite-members

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b286ba7 and 3e16f0c.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

For blocking alerts and errors in UI, do not use toast notifications; use alerts instead

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer ES6 Map over Record when representing key–value collections

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Keep hover/click animations snappy; avoid pre-transition delays on hover and apply transitions after the action (e.g., fade-out on hover end)

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
🧬 Code graph analysis (1)
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx (1)
apps/dashboard/src/components/project-card.tsx (1)
  • ProjectCard (8-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: build (22.x)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: setup-tests
  • GitHub Check: check_prisma_migrations (22.x)
  • GitHub Check: all-good
  • GitHub Check: build (22.x)
  • GitHub Check: docker
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: docker
  • GitHub Check: Security Check

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR significantly improves the user experience of the team member invitation feature in the dashboard. The changes focus on making the invite functionality more discoverable and accessible by restructuring the layout and improving visual hierarchy.

The core change involves moving the invite button from being embedded within the team name label (as a small icon-only button) to a dedicated position on the right side of the team header. The new layout uses a flex container with justify-between to clearly separate the team name on the left from the invite action on the right. The button itself has been enhanced from a minimal icon-only design to a more prominent button that includes both a UserPlus icon and descriptive text ("Invite Teammate"), making its purpose immediately clear to users.

The PR also includes important backend improvements to the validation logic. The previous implementation used reactive hooks to check user counts, but this has been refactored to use async API calls (Promise.all with listUsers() and getItem("dashboard_admins")) for more precise control over when validation occurs. This change likely addresses potential race conditions or stale data issues during the validation process.

Additionally, the dialog title has been improved to show the team name dynamically, and the Suspense wrapper around the dialog component has been removed, simplifying the loading state management. These changes integrate well with the existing codebase structure, maintaining the same core functionality while significantly enhancing discoverability and user experience.

Important Files Changed

Changed Files
Filename Score Overview
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx 4/5 Improved team member invitation UX by moving invite button to prominent position with descriptive text and refactored validation logic to use async API calls

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it primarily improves UI/UX without breaking existing functionality
  • Score reflects well-structured changes that enhance user experience while maintaining proper validation logic
  • Pay close attention to the validation logic refactoring to ensure async API calls work correctly in all scenarios

Sequence Diagram

sequenceDiagram
    participant User
    participant PageClient
    participant TeamAddUserDialog
    participant FormDialog
    participant Team
    participant Router

    User->>PageClient: "Load projects page"
    PageClient->>PageClient: "Filter and sort projects by team"
    PageClient->>User: "Display projects grouped by team with invite buttons"
    
    User->>TeamAddUserDialog: "Click 'Invite Teammate' button"
    TeamAddUserDialog->>FormDialog: "Open invite dialog"
    FormDialog->>User: "Show email input form"
    
    User->>FormDialog: "Enter email and submit"
    FormDialog->>TeamAddUserDialog: "Trigger onSubmit with email"
    TeamAddUserDialog->>Team: "listUsers()"
    Team->>TeamAddUserDialog: "Return user list"
    TeamAddUserDialog->>Team: "getItem('dashboard_admins')"
    Team->>TeamAddUserDialog: "Return admin quota"
    
    alt User limit reached
        TeamAddUserDialog->>User: "Show quota limit alert"
        TeamAddUserDialog->>Team: "createCheckoutUrl()"
        Team->>TeamAddUserDialog: "Return checkout URL"
        TeamAddUserDialog->>Router: "Redirect to checkout"
    else User limit not reached
        TeamAddUserDialog->>PageClient: "Call props.inviteUser()"
        PageClient->>PageClient: "Execute invite user function"
        PageClient->>TeamAddUserDialog: "Return success"
        TeamAddUserDialog->>User: "Show success toast"
        TeamAddUserDialog->>FormDialog: "Close dialog"
    end
Loading

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link

@recurseml recurseml 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 RecurseML

🔍 Review performed on 017b43f..fc3e92c

  Severity     Location     Issue     Delete  
Low apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx:150 Incorrect displayName rendering

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx (1)

105-109: Inline the computed team instance once.

We call teams.find(...) inside the conditional and again when passing the prop, so we walk the array twice on every render. Hoist the result into a const team = ... and reuse it to keep the render path clean.

Apply this diff:

-            {teamId && teams.find(t => t.id === teamId) && (
-              <TeamAddUserDialog
-                team={teams.find(t => t.id === teamId)!}
+            {teamId && (() => {
+              const team = teams.find((t) => t.id === teamId);
+              if (!team) return null;
+              return (
+                <TeamAddUserDialog
+                  team={team}
                   onSubmit={(email) => props.inviteUser(window.location.origin, teamId, email)}
-              />
-            )}
+                />
+              );
+            })()}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 017b43f and fc3e92c.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

For blocking alerts and errors in UI, do not use toast notifications; use alerts instead

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer ES6 Map over Record when representing key–value collections

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Keep hover/click animations snappy; avoid pre-transition delays on hover and apply transitions after the action (e.g., fade-out on hover end)

Files:

  • apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: build (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: docker
  • GitHub Check: setup-tests
  • GitHub Check: restart-dev-and-test
  • GitHub Check: all-good
  • GitHub Check: docker
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: Security Check

@BilalG1 BilalG1 requested a review from N2D4 October 7, 2025 21:51
@BilalG1 BilalG1 assigned N2D4 and unassigned BilalG1 Oct 7, 2025
Copy link
Contributor

@N2D4 N2D4 left a comment

Choose a reason for hiding this comment

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

can we instead have a gear button (eg. SettingsIconButton) to the right side of the team name? the button is too big imo

@github-actions github-actions bot assigned BilalG1 and unassigned N2D4 Oct 10, 2025
@BilalG1 BilalG1 requested a review from N2D4 October 10, 2025 21:28
@BilalG1 BilalG1 removed their assignment Oct 10, 2025
cursor[bot]

This comment was marked as outdated.

@github-actions github-actions bot assigned BilalG1 and unassigned N2D4 Oct 15, 2025
@BilalG1 BilalG1 merged commit 0ac2b00 into dev Oct 15, 2025
17 of 22 checks passed
@BilalG1 BilalG1 deleted the more-visible-invite-members branch October 15, 2025 22:21
N2D4 added a commit that referenced this pull request Oct 16, 2025
<img width="1458" height="968" alt="Screenshot 2025-10-10 at 2 27 00 PM"
src="https://github.com/user-attachments/assets/ad2a4ecb-35b8-4b8b-a553-899ce0096d7a"
/>
(PAST)
<img width="1483" height="608" alt="Screenshot 2025-10-07 at 1 54 00 PM"
src="https://github.com/user-attachments/assets/abb854ba-fd9b-41de-a755-432262c8e1b2"
/>

<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- RECURSEML_SUMMARY:START -->
## High-level PR Summary
This PR improves the visibility and usability of the team member
invitation feature by replacing a small icon button with a more
prominent button labeled "Invite Teammate", reorganizing the team header
layout to better position the invite button, and making the invite
functionality more robust by fetching user and admin data asynchronously
instead of using hooks.

⏱️ Estimated Review Time: 5-15 minutes

<details>
<summary>💡 Review Order Suggestion</summary>

| Order | File Path |
|-------|-----------|
| 1 |
`apps/dashboard/src/app/(main)/(protected)/(outside-dashboard)/projects/page-client.tsx`
|
</details>



[![Need help? Join our
Discord](https://img.shields.io/badge/Need%20help%3F%20Join%20our%20Discord-5865F2?style=plastic&logo=discord&logoColor=white)](https://discord.gg/n3SsVDAW6U)


[![Analyze latest
changes](https://img.shields.io/badge/Analyze%20latest%20changes-238636?style=plastic)](https://squash-322339097191.europe-west3.run.app/interactive/c4a12ca45690d2b2efe881942a7d9c195dff13ea7131f2b33fa1377eb7b3cbb8/?repo_owner=stack-auth&repo_name=stack-auth&pr_number=932)
<!-- RECURSEML_SUMMARY:END -->
<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Enhances team member invitation UI and refactors data fetching in
`page-client.tsx` for better usability and robustness.
> 
>   - **UI Enhancements**:
> - Replaced icon-only invite button with a ghost button labeled "Invite
Teammate" in `page-client.tsx`.
> - Reorganized team header layout to better position the invite button.
>   - **Data Fetching**:
> - Updated `TeamAddUserDialog` to fetch user and admin data
asynchronously instead of using hooks.
> - Validates admin limits at submission time in `TeamAddUserDialog`.
>   - **Misc**:
> - Dialog title now reflects the team's display name in
`TeamAddUserDialog`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 3e16f0c. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

----


<!-- ELLIPSIS_HIDDEN -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Projects are now grouped by team with readable team labels and a “No
Team” fallback; each team shows its own project grid.
* The “Add User” dialog is available next to each team and shows the
team’s display name in the title.

* **Style**
* Replaced icon-only trigger with a ghost button using a settings icon
and improved accessibility.

* **Chores**
  * Invite submission now validates current admin limits at submit time.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
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