Skip to content

Commit 92d1ae4

Browse files
committed
fix(webapp): hide no-billing-limit banner for users without billing permissions
1 parent 1a60059 commit 92d1ae4

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

apps/webapp/app/components/billing/OrgBanner.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,26 @@ function NoLimitConfiguredBanner({ onBillingLimitsPage }: { onBillingLimitsPage:
147147
const organization = useOrganization();
148148
const canManageBillingLimits = useCanManageBillingLimits();
149149

150-
const message = canManageBillingLimits
151-
? onBillingLimitsPage
152-
? "Please configure a billing limit to protect your organization from unexpected usage spikes."
153-
: "Protect your organization from unexpected usage spikes."
154-
: "Billing limits are not configured for this organization. Contact an organization administrator to configure them.";
150+
// Users who can't manage billing limits can't act on this — no banner for them.
151+
if (!canManageBillingLimits) {
152+
return null;
153+
}
155154

156155
return (
157156
<AnimatedOrgBannerBar
158157
show
159158
variant="warning"
160159
action={
161-
canManageBillingLimits && !onBillingLimitsPage ? (
160+
onBillingLimitsPage ? undefined : (
162161
<LinkButton variant="tertiary/small" to={v3BillingLimitsPath(organization)}>
163162
Configure billing limit
164163
</LinkButton>
165-
) : undefined
164+
)
166165
}
167166
>
168-
{message}
167+
{onBillingLimitsPage
168+
? "Please configure a billing limit to protect your organization from unexpected usage spikes."
169+
: "Protect your organization from unexpected usage spikes."}
169170
</AnimatedOrgBannerBar>
170171
);
171172
}

0 commit comments

Comments
 (0)