Skip to content

[Dashboard] Restrict billing actions to team owners only #7274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jnsdls
Copy link
Member

@jnsdls jnsdls commented Jun 4, 2025

Improve Billing UI for Non-Owner Team Members

This PR enhances the billing UI to properly handle permissions for team members who aren't owners. It:

  • Restricts billing actions to team owners only
  • Adds tooltips explaining why certain actions are disabled
  • Properly disables buttons for non-owner team members
  • Improves the Button component to handle disabled state for non-button elements

Key Changes:

  • Added isOwnerAccount flag to billing components to conditionally render or disable actions
  • Enhanced Button component to properly handle disabled state for non-button elements (like anchor tags)
  • Added tooltips to explain why actions are disabled for non-owners
  • Restricted the following actions to team owners only:
    • Selecting/changing plans
    • Managing billing
    • Topping up credits
    • Paying invoices

These changes ensure a better UX for team members who don't have billing permissions while maintaining full functionality for team owners.

Summary by CodeRabbit

  • New Features
    • Added owner-only restrictions for billing and payment actions. Only team owners can change plans, manage billing, top up credits, or pay invoices. Non-owner users now see disabled buttons with tooltips explaining these restrictions.
  • Accessibility
    • Improved accessibility for disabled buttons by adding appropriate ARIA attributes and visual indicators.
  • User Interface
    • Updated tooltips and button states to clearly communicate permission-based access to billing features.
    • Enhanced button behavior to consistently reflect disabled states across different elements and contexts.
  • Bug Fixes
    • Standardized disabled state handling for buttons and interactive elements, ensuring consistent visual and functional behavior.
  • Chores
    • Replaced internal navigation links with standard anchor elements for external billing-related links, improving security with added link attributes.
    • Added default button types and improved disabled state handling for custom button components.

PR-Codex overview

This PR focuses on enhancing the user interface and experience by improving accessibility and functionality for owner accounts in various billing and subscription components.

Detailed summary

  • Changed <Link> to <a> in billing.tsx for better link handling.
  • Added isOwnerAccount prop to multiple components for owner-specific functionality.
  • Enhanced button accessibility by adding disabled states and tooltips.
  • Updated billing-related components to conditionally render actions based on ownership.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 19:50 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 19:50 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 19:50 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 19:50 Inactive
Copy link

vercel bot commented Jun 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 9:10pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Jun 4, 2025 9:10pm
login ⬜️ Skipped (Inspect) Jun 4, 2025 9:10pm
thirdweb_playground ⬜️ Skipped (Inspect) Jun 4, 2025 9:10pm
wallet-ui ⬜️ Skipped (Inspect) Jun 4, 2025 9:10pm

Copy link

changeset-bot bot commented Jun 4, 2025

⚠️ No Changeset found

Latest commit: a920d1e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

"""

Walkthrough

The changes introduce an isOwnerAccount boolean prop throughout the billing and invoice management components to restrict certain actions (like changing plans, topping up credits, and paying invoices) to team owners only. Button and UI logic are updated to respect this prop, disabling controls and showing tooltips for non-owners. The code now fetches the current user's team role to determine ownership. Additionally, the generic Button component was improved to better handle disabled states and accessibility.

Changes

Files/Groups Change Summary
apps/dashboard/src/@/components/ui/button.tsx Button component now explicitly accepts a disabled prop, handles native and non-native elements, and improves accessibility.
.../settings/billing/components/PlanInfoCard.client.tsx,
PlanInfoCard.tsx,
PlanInfoCard.stories.tsx
Added isOwnerAccount prop to PlanInfoCardClient and PlanInfoCardUI; updated stories to include the new prop.
.../settings/billing/components/credit-balance-section.client.tsx Added isOwnerAccount prop; disables "Top Up With Crypto" button and shows tooltip for non-owners; refactored button/link structure.
.../settings/billing/page.tsx Fetches current user's team role, determines isOwnerAccount, and passes it to billing components.
.../settings/invoices/components/billing-history.tsx Added isOwnerAccount prop; disables payment buttons and shows tooltip for non-owners; refactored button/link structure.
.../settings/invoices/page.tsx Fetches current user's team role, determines isOwnerAccount, and passes it to BillingHistory component.
apps/dashboard/src/@/components/billing.tsx Replaced next/link with anchor <a> element in BillingPortalButton, adding rel="noreferrer" for security.
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(general)/layout.tsx Changed import of TabPathLinks to absolute path.
apps/dashboard/src/components/analytics/empty-chart-state.tsx Changed import of cn utility to absolute path.
apps/dashboard/src/components/settings/Account/Billing/CancelPlanModal/CancelPlanModal.tsx Added optional disabled prop to CancelPlanButton and ImmediateCancelPlanButton components to externally disable cancel buttons.
apps/dashboard/src/components/settings/Account/Billing/renew-subscription/renew-subscription-button.tsx Added optional disabled prop to RenewSubscriptionButton to externally disable the button.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Page
    participant Auth
    participant Team
    participant Member
    participant UIComponents

    User->>Page: Visit billing/invoices page
    Page->>Auth: getValidAccount()
    Auth-->>Page: accountId
    Page->>Team: getTeam(team_slug)
    Page->>Member: getMemberById(team_slug, accountId)
    Team-->>Page: team
    Member-->>Page: member (with role)
    Page->>Page: Determine isOwnerAccount = (member.role == "OWNER")
    Page->>UIComponents: Render with isOwnerAccount prop
    UIComponents->>User: Show/hide/disable controls based on isOwnerAccount
Loading

Suggested reviewers

  • jnsdls
  • joaquim-verges
    """

📜 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 4abbefa and a920d1e.

📒 Files selected for processing (13)
  • apps/dashboard/src/@/components/billing.tsx (1 hunks)
  • apps/dashboard/src/@/components/ui/button.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.client.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.stories.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/credit-balance-section.client.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/page.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/invoices/components/billing-history.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/invoices/page.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(general)/layout.tsx (1 hunks)
  • apps/dashboard/src/components/analytics/empty-chart-state.tsx (1 hunks)
  • apps/dashboard/src/components/settings/Account/Billing/CancelPlanModal/CancelPlanModal.tsx (3 hunks)
  • apps/dashboard/src/components/settings/Account/Billing/renew-subscription/renew-subscription-button.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(general)/layout.tsx
  • apps/dashboard/src/components/analytics/empty-chart-state.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.stories.tsx
  • apps/dashboard/src/@/components/billing.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/invoices/page.tsx
  • apps/dashboard/src/@/components/ui/button.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/components/credit-balance-section.client.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/page.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/invoices/components/billing-history.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/components/settings/Account/Billing/CancelPlanModal/CancelPlanModal.tsx (2)
apps/dashboard/src/@/components/ui/sheet.tsx (2)
  • Sheet (133-133)
  • SheetTrigger (136-136)
apps/dashboard/src/@/components/ui/button.tsx (1)
  • Button (85-85)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
apps/dashboard/src/components/settings/Account/Billing/renew-subscription/renew-subscription-button.tsx (2)

18-18: LGTM! Clean prop addition.

The optional disabled prop is properly typed and follows TypeScript best practices for optional boolean props.


75-75: LGTM! Proper disabled state logic.

The disabled state correctly combines the internal loading state (showSpinner) with the external disabled prop using logical OR. This ensures the button remains disabled during loading operations or when explicitly disabled by the parent component.

apps/dashboard/src/components/settings/Account/Billing/CancelPlanModal/CancelPlanModal.tsx (4)

29-29: LGTM! Consistent prop typing.

The optional disabled prop follows the same pattern established in the RenewSubscriptionButton component, maintaining consistency across the billing UI.


37-37: LGTM! Proper prop threading.

The disabled prop is correctly passed down to the ImmediateCancelPlanButton component, ensuring the disabled state is respected in the simplified flow.


45-50: LGTM! Disabled state applied to Sheet trigger.

The disabled prop is properly applied to the Sheet trigger Button, which will prevent non-owner users from opening the cancel plan modal while maintaining the existing UI styling.


117-117: LGTM! Consistent disabled state implementation.

The ImmediateCancelPlanButton follows the same pattern as other billing components:

  • Properly typed optional disabled prop
  • Correct combination of loading state and external disabled flag
  • Maintains existing functionality while adding ownership-based restrictions

Also applies to: 155-155

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Jun 4, 2025
Copy link
Member Author

jnsdls commented Jun 4, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jnsdls jnsdls marked this pull request as ready for review June 4, 2025 19:51
@jnsdls jnsdls requested review from a team as code owners June 4, 2025 19:51
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.57%. Comparing base (2329a22) to head (a920d1e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7274   +/-   ##
=======================================
  Coverage   55.57%   55.57%           
=======================================
  Files         909      909           
  Lines       58667    58667           
  Branches     4158     4158           
=======================================
  Hits        32606    32606           
  Misses      25954    25954           
  Partials      107      107           
Flag Coverage Δ
packages 55.57% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jnsdls jnsdls force-pushed the _Dashboard_Restrict_billing_actions_to_team_owners_only branch from 7950a92 to a105282 Compare June 4, 2025 19:53
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 19:53 Inactive
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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🛑 Comments failed to post (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/page.tsx (1)

31-35: 🛠️ Refactor suggestion

Add error handling for team member lookup.

The getMemberById call could fail or return null, which would cause issues with the ownership check. Consider adding proper error handling.

  const [team, authToken, teamMember] = await Promise.all([
    getTeamBySlug(params.team_slug),
    getAuthToken(),
    getMemberById(params.team_slug, account.id),
  ]);
+
+ if (!teamMember) {
+   // Handle case where user is not a team member
+   redirect("/team");
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  const [team, authToken, teamMember] = await Promise.all([
    getTeamBySlug(params.team_slug),
    getAuthToken(),
    getMemberById(params.team_slug, account.id),
  ]);

  if (!teamMember) {
    // Handle case where user is not a team member
    redirect("/team");
  }
🤖 Prompt for AI Agents
In
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/billing/page.tsx
around lines 31 to 35, the call to getMemberById may fail or return null, which
can break the ownership check logic. Add error handling by wrapping the
Promise.all call in a try-catch block or by checking if the teamMember result is
null after the call. If an error occurs or teamMember is null, handle it
gracefully, such as by showing an error message or redirecting, to prevent
runtime issues.

@jnsdls jnsdls force-pushed the _Dashboard_Restrict_billing_actions_to_team_owners_only branch from a105282 to 61178d9 Compare June 4, 2025 19:57
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 19:57 Inactive
@jnsdls jnsdls force-pushed the _Dashboard_Restrict_billing_actions_to_team_owners_only branch from 61178d9 to 1a675e4 Compare June 4, 2025 19:58
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 19:58 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 19:58 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 19:58 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 19:58 Inactive
Copy link
Contributor

github-actions bot commented Jun 4, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.57 KB (0%) 1.3 s (0%) 225 ms (+161.63% 🔺) 1.5 s
thirdweb (cjs) 345.38 KB (0%) 7 s (0%) 670 ms (+8.92% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 59 ms (+1175.95% 🔺) 173 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 38 ms (+2026.97% 🔺) 49 ms
thirdweb/react (minimal + tree-shaking) 19.56 KB (0%) 392 ms (0%) 86 ms (+749.84% 🔺) 478 ms

Copy link
Contributor

graphite-app bot commented Jun 4, 2025

Merge activity

graphite-app bot pushed a commit that referenced this pull request Jun 4, 2025
# Improve Billing UI for Non-Owner Team Members

This PR enhances the billing UI to properly handle permissions for team members who aren't owners. It:

- Restricts billing actions to team owners only
- Adds tooltips explaining why certain actions are disabled
- Properly disables buttons for non-owner team members
- Improves the Button component to handle disabled state for non-button elements

## Key Changes:

- Added `isOwnerAccount` flag to billing components to conditionally render or disable actions
- Enhanced Button component to properly handle disabled state for non-button elements (like anchor tags)
- Added tooltips to explain why actions are disabled for non-owners
- Restricted the following actions to team owners only:
  - Selecting/changing plans
  - Managing billing
  - Topping up credits
  - Paying invoices

These changes ensure a better UX for team members who don't have billing permissions while maintaining full functionality for team owners.

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

- **New Features**
	- Added owner-only restrictions for billing and payment actions. Only team owners can change plans, manage billing, top up credits, or pay invoices. Non-owner users now see disabled buttons with tooltips explaining these restrictions.
- **Accessibility**
	- Improved accessibility for disabled buttons by adding appropriate ARIA attributes and visual indicators.
- **User Interface**
	- Updated tooltips and button states to clearly communicate permission-based access to billing features.
	- Enhanced button behavior to consistently reflect disabled states across different elements and contexts.
- **Bug Fixes**
	- Standardized disabled state handling for buttons and interactive elements, ensuring consistent visual and functional behavior.
- **Chores**
	- Replaced internal navigation links with standard anchor elements for external billing-related links, improving security with added link attributes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing user experience by adding an `isOwnerAccount` boolean prop to various components. This prop controls the visibility and functionality of certain actions, ensuring that only team owners can perform specific tasks.

### Detailed summary
- Changed `<Link>` to `<a>` in `billing.tsx` for proper link behavior.
- Added `isOwnerAccount` prop to multiple components and updated their functionality based on ownership status.
- Introduced `ToolTipLabel` to provide contextual information for actions restricted to team owners.
- Updated button states to reflect whether actions are enabled or disabled based on `isOwnerAccount`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
@graphite-app graphite-app bot force-pushed the _Dashboard_Restrict_billing_actions_to_team_owners_only branch from 1a675e4 to 4abbefa Compare June 4, 2025 20:50
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 20:50 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 20:50 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 20:50 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 20:50 Inactive
Copy link
Member

@MananTank MananTank left a comment

Choose a reason for hiding this comment

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

Can't remove the "button" type default

# Improve Billing UI for Non-Owner Team Members

This PR enhances the billing UI to properly handle permissions for team members who aren't owners. It:

- Restricts billing actions to team owners only
- Adds tooltips explaining why certain actions are disabled
- Properly disables buttons for non-owner team members
- Improves the Button component to handle disabled state for non-button elements

## Key Changes:

- Added `isOwnerAccount` flag to billing components to conditionally render or disable actions
- Enhanced Button component to properly handle disabled state for non-button elements (like anchor tags)
- Added tooltips to explain why actions are disabled for non-owners
- Restricted the following actions to team owners only:
  - Selecting/changing plans
  - Managing billing
  - Topping up credits
  - Paying invoices

These changes ensure a better UX for team members who don't have billing permissions while maintaining full functionality for team owners.

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

- **New Features**
	- Added owner-only restrictions for billing and payment actions. Only team owners can change plans, manage billing, top up credits, or pay invoices. Non-owner users now see disabled buttons with tooltips explaining these restrictions.
- **Accessibility**
	- Improved accessibility for disabled buttons by adding appropriate ARIA attributes and visual indicators.
- **User Interface**
	- Updated tooltips and button states to clearly communicate permission-based access to billing features.
	- Enhanced button behavior to consistently reflect disabled states across different elements and contexts.
- **Bug Fixes**
	- Standardized disabled state handling for buttons and interactive elements, ensuring consistent visual and functional behavior.
- **Chores**
	- Replaced internal navigation links with standard anchor elements for external billing-related links, improving security with added link attributes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing user experience by adding an `isOwnerAccount` boolean prop to various components. This prop controls the visibility and functionality of certain actions, ensuring that only team owners can perform specific tasks.

### Detailed summary
- Changed `<Link>` to `<a>` in `billing.tsx` for proper link behavior.
- Added `isOwnerAccount` prop to multiple components and updated their functionality based on ownership status.
- Introduced `ToolTipLabel` to provide contextual information for actions restricted to team owners.
- Updated button states to reflect whether actions are enabled or disabled based on `isOwnerAccount`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
@jnsdls jnsdls force-pushed the _Dashboard_Restrict_billing_actions_to_team_owners_only branch from 4abbefa to a920d1e Compare June 4, 2025 21:03
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 4, 2025 21:03 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 4, 2025 21:03 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 4, 2025 21:03 Inactive
@vercel vercel bot temporarily deployed to Preview – login June 4, 2025 21:03 Inactive
@graphite-app graphite-app bot merged commit a920d1e into main Jun 4, 2025
25 checks passed
@graphite-app graphite-app bot deleted the _Dashboard_Restrict_billing_actions_to_team_owners_only branch June 4, 2025 21:11
@vercel vercel bot temporarily deployed to Production – docs-v2 June 4, 2025 21:11 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground June 4, 2025 21:11 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui June 4, 2025 21:11 Inactive
@vercel vercel bot temporarily deployed to Production – login June 4, 2025 21:11 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants