Skip to content

Commit f95a0bf

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: cleanup disabled team management UIs for vercel teams (#40865)
GitOrigin-RevId: f0278f7596978dee46e5c5dc817a3bba5b8e7fe3
1 parent 370f237 commit f95a0bf

File tree

6 files changed

+75
-61
lines changed

6 files changed

+75
-61
lines changed

npm-packages/@convex-dev/design-system/src/Callout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const classes: Record<CalloutVariant, string> = {
66
error: "bg-background-error text-content-error",
77
instructions: "bg-background-warning text-content-warning",
88
hint: "bg-util-accent/10",
9-
upsell: "bg-util-accent/10",
9+
upsell: "bg-util-accent/10 dark:bg-util-accent/30",
1010
localDev:
1111
"bg-teal-100 border border-teal-500 dark:bg-teal-900 text-content-primary",
1212
};

npm-packages/dashboard/src/components/billing/PriceSummary.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ export function PriceSummary({
2727
return (
2828
<div className="flex flex-col gap-2 text-sm" data-testid="price-summary">
2929
{teamManagedBy && (
30-
<Callout className="mb-2">
31-
This team's billing is currently being managed by{" "}
32-
{startCase(teamManagedBy)}. Upgrading to this plan will disable your{" "}
33-
{startCase(teamManagedBy)} integration and migrate billing to be
34-
handled by Convex.
30+
<Callout className="mb-2 flex flex-col gap-1" variant="upsell">
31+
<p>
32+
This team's billing is currently being managed by{" "}
33+
{startCase(teamManagedBy)}.
34+
</p>
35+
<p>
36+
To switch to {newPlanName}, you may create a new Convex team, and
37+
upgrade that team to the Professional plan.{" "}
38+
</p>
39+
<p>
40+
Once you've created a new team with the Professional plan, you can
41+
transfer your existing projects to the new team and invite your team
42+
members.
43+
</p>
3544
</Callout>
3645
)}
3746
{plan.seatPrice ? (

npm-packages/dashboard/src/components/billing/SubscriptionOverview.tsx

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,31 @@ export function SubscriptionOverview({
115115
team={team}
116116
hasAdminPermissions={hasAdminPermissions}
117117
/>
118-
<hr />
119-
<BillingContactForm
120-
subscription={subscription}
121-
team={team}
122-
hasAdminPermissions={hasAdminPermissions}
123-
/>
124-
<hr />
125-
<BillingAddressForm
126-
subscription={subscription}
127-
team={team}
128-
hasAdminPermissions={hasAdminPermissions}
129-
/>
130-
<hr />
131-
<PaymentMethodForm
132-
subscription={subscription}
133-
team={team}
134-
hasAdminPermissions={hasAdminPermissions}
135-
/>
118+
{!team.managedBy && (
119+
<>
120+
<hr />
121+
<BillingContactForm
122+
subscription={subscription}
123+
team={team}
124+
hasAdminPermissions={hasAdminPermissions}
125+
/>
126+
<hr />
127+
<BillingAddressForm
128+
subscription={subscription}
129+
team={team}
130+
hasAdminPermissions={hasAdminPermissions}
131+
/>
132+
<hr />
133+
<PaymentMethodForm
134+
subscription={subscription}
135+
team={team}
136+
hasAdminPermissions={hasAdminPermissions}
137+
/>
138+
</>
139+
)}
136140
</Sheet>
137141
)}
138-
{invoices && (invoices.length > 0 || subscription) && (
142+
{!team.managedBy && invoices && (invoices.length > 0 || subscription) && (
139143
<Invoices invoices={invoices} />
140144
)}
141145
</>

npm-packages/dashboard/src/components/billing/TeamUsage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ export function TeamUsage({ team }: { team: Team }) {
149149
size="xs"
150150
>
151151
{subscription
152-
? "View Subscription & Invoices"
152+
? team.managedBy
153+
? "View Subscription"
154+
: "View Subscription & Invoices"
153155
: "Upgrade Subscription"}
154156
</Button>
155157
)}

npm-packages/dashboard/src/components/billing/planCards/ChangePlanDialogs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function UpgradePlanDialog({
144144
)}
145145
</div>
146146
}
147-
disableConfirm={couponData.isLoading}
147+
disableConfirm={!!team.managedBy || couponData.isLoading}
148148
variant="primary"
149149
confirmText="Upgrade"
150150
onConfirm={() => onConfirm(couponData.coupon?.planId ?? newPlan.id)}

npm-packages/dashboard/src/components/teamSettings/TeamSettings.tsx

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,48 +40,47 @@ export function TeamSettings({ team }: { team: Team }) {
4040
remove all team members and delete all projects associated with the
4141
team.
4242
</p>
43-
{team.managedBy && (
44-
<Callout>
45-
This team is managed by {startCase(team.managedBy)}. You must delete
46-
the integration in {startCase(team.managedBy)} before you can delete
47-
this team.
48-
</Callout>
49-
)}
5043
{subscription && (
5144
<p className="mb-4">
5245
Deleting your team will automatically cancel your{" "}
5346
<span className="font-semibold">{subscription.plan.name}</span>{" "}
5447
subscription.
5548
</p>
5649
)}
57-
{!team.managedBy && (
58-
<Button
59-
variant="danger"
60-
onClick={() => setShowDeleteTeamModal(true)}
61-
disabled={
62-
!hasAdminPermissions ||
63-
!teams ||
64-
teams.length === 1 ||
65-
!teamMembers ||
66-
teamMembers.length > 1 ||
67-
!projects ||
68-
projects.length > 0
69-
}
70-
tip={
71-
!hasAdminPermissions
72-
? "You do not have permission to delete this team."
73-
: teams && teams.length === 1
74-
? "You cannot delete your last team."
75-
: teamMembers && teamMembers.length > 1
76-
? "You must remove all other team members before deleting the team."
77-
: projects && projects.length > 0
78-
? "You must delete all projects before deleting the team."
79-
: undefined
80-
}
81-
>
82-
Delete Team
83-
</Button>
50+
{team.managedBy && (
51+
<Callout className="mb-4">
52+
This team is managed by {startCase(team.managedBy)}. You must delete
53+
the integration in {startCase(team.managedBy)} before you can delete
54+
this team.
55+
</Callout>
8456
)}
57+
<Button
58+
variant="danger"
59+
onClick={() => setShowDeleteTeamModal(true)}
60+
disabled={
61+
!!team.managedBy ||
62+
!hasAdminPermissions ||
63+
!teams ||
64+
teams.length === 1 ||
65+
!teamMembers ||
66+
teamMembers.length > 1 ||
67+
!projects ||
68+
projects.length > 0
69+
}
70+
tip={
71+
!hasAdminPermissions
72+
? "You do not have permission to delete this team."
73+
: teams && teams.length === 1
74+
? "You cannot delete your last team."
75+
: teamMembers && teamMembers.length > 1
76+
? "You must remove all other team members before deleting the team."
77+
: projects && projects.length > 0
78+
? "You must delete all projects before deleting the team."
79+
: undefined
80+
}
81+
>
82+
Delete Team
83+
</Button>
8584
{showDeleteTeamModal && (
8685
<ConfirmationDialog
8786
onClose={() => setShowDeleteTeamModal(false)}

0 commit comments

Comments
 (0)