Skip to content

Commit 0e3c379

Browse files
committed
Make the branches progress bar red if you have no branches available
1 parent 129b29c commit 0e3c379

File tree

1 file changed

+6
-4
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches

1 file changed

+6
-4
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ export default function Page() {
246246
!plan.v3Subscription.plan.limits.branches.canExceed;
247247
const canUpgrade =
248248
plan?.v3Subscription?.plan && !plan.v3Subscription.plan.limits.branches.canExceed;
249+
const atBranchLimit = limits.used >= limits.limit;
250+
const usageRatio = limits.limit > 0 ? Math.min(limits.used / limits.limit, 1) : 0;
249251

250252
if (!branchableEnvironment) {
251253
return (
@@ -461,20 +463,20 @@ export default function Page() {
461463
/>
462464
<circle
463465
className={`fill-none ${
464-
requiresUpgrade ? "stroke-error" : "stroke-success"
466+
atBranchLimit ? "stroke-error" : "stroke-success"
465467
}`}
466468
strokeWidth="4"
467469
r="10"
468470
cx="12"
469471
cy="12"
470-
strokeDasharray={`${(limits.used / limits.limit) * 62.8} 62.8`}
472+
strokeDasharray={`${usageRatio * 62.8} 62.8`}
471473
strokeDashoffset="0"
472474
strokeLinecap="round"
473475
/>
474476
</svg>
475477
</div>
476478
}
477-
content={`${Math.round((limits.used / limits.limit) * 100)}%`}
479+
content={`${Math.round(usageRatio * 100)}%`}
478480
/>
479481
<div className="flex w-full items-center justify-between gap-6">
480482
{requiresUpgrade ? (
@@ -484,7 +486,7 @@ export default function Page() {
484486
</Header3>
485487
) : (
486488
<div className="flex items-center gap-1">
487-
<Header3>
489+
<Header3 className={atBranchLimit ? "text-error" : undefined}>
488490
You've used {limits.used}/{limits.limit} of your branches
489491
</Header3>
490492
<InfoIconTooltip content="Archived branches don't count towards your limit." />

0 commit comments

Comments
 (0)