fix: credit display and top up and other UI display if personal membe… (#8784)

## Summary

Consolidate scattered role checks for credits, top-up, and subscribe
buttons into centralized workspace permissions (canTopUp,
canManageSubscription), ensuring "Add Credits" requires an active
subscription, subscribe buttons only appear when needed, and team
members see appropriately restricted billing UI.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8784-fix-credit-display-and-top-up-and-other-UI-display-if-personal-membe-3036d73d3650810fbc2de084f738943c)
by [Unito](https://www.unito.io)
This commit is contained in:
Simula_r
2026-02-11 14:26:35 -08:00
committed by GitHub
parent adcb663b3e
commit dd1fefe843
4 changed files with 107 additions and 104 deletions

View File

@@ -14,6 +14,7 @@ interface WorkspacePermissions {
canLeaveWorkspace: boolean
canAccessWorkspaceMenu: boolean
canManageSubscription: boolean
canTopUp: boolean
}
/** UI configuration for workspace role */
@@ -44,7 +45,8 @@ function getPermissions(
canRemoveMembers: false,
canLeaveWorkspace: false,
canAccessWorkspaceMenu: false,
canManageSubscription: true
canManageSubscription: true,
canTopUp: true
}
}
@@ -57,7 +59,8 @@ function getPermissions(
canRemoveMembers: true,
canLeaveWorkspace: true,
canAccessWorkspaceMenu: true,
canManageSubscription: true
canManageSubscription: true,
canTopUp: true
}
}
@@ -70,7 +73,8 @@ function getPermissions(
canRemoveMembers: false,
canLeaveWorkspace: true,
canAccessWorkspaceMenu: true,
canManageSubscription: false
canManageSubscription: false,
canTopUp: false
}
}