Skip to content

Commit 0098b51

Browse files
committed
Show the extra branches purchased in the footer UI
1 parent 174e289 commit 0098b51

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ function PurchaseBranchesModal({
707707
<input type="hidden" name="_formType" value="purchase-branches" />
708708
<div className="flex flex-col gap-4 pt-2">
709709
<div className="flex flex-col gap-1">
710-
<Paragraph variant="base/bright">
710+
<Paragraph variant="small/bright">
711711
Purchase extra preview branches at {formatCurrency(pricePerBranch, false)}/month per
712712
branch. Reducing the number of branches will take effect at the start of the next
713713
billing cycle (1st of the month).

apps/webapp/app/services/upsertBranch.server.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createApiKeyForEnv, createPkApiKeyForEnv } from "~/models/api-key.serve
55
import { type CreateBranchOptions } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route";
66
import { isValidGitBranchName, sanitizeBranchName } from "~/v3/gitBranch";
77
import { logger } from "./logger.server";
8-
import { getLimit } from "./platform.v3.server";
8+
import { getCurrentPlan, getLimit } from "./platform.v3.server";
99

1010
export class UpsertBranchService {
1111
#prismaClient: PrismaClient;
@@ -177,7 +177,10 @@ export async function checkBranchLimit(
177177
const count = newBranchName
178178
? usedEnvs.filter((env) => env.branchName !== newBranchName).length
179179
: usedEnvs.length;
180-
const limit = await getLimit(organizationId, "branches", 100_000_000);
180+
const baseLimit = await getLimit(organizationId, "branches", 100_000_000);
181+
const currentPlan = await getCurrentPlan(organizationId);
182+
const purchasedBranches = currentPlan?.v3Subscription?.addOns?.branches?.purchased ?? 0;
183+
const limit = baseLimit + purchasedBranches;
181184

182185
return {
183186
used: count,

0 commit comments

Comments
 (0)