Skip to content

Commit 0974c1c

Browse files
committed
Show cost breakdown in the modal
1 parent ca626ec commit 0974c1c

File tree

1 file changed

+48
-10
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.concurrency

1 file changed

+48
-10
lines changed

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

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,36 +448,74 @@ function PurchaseConcurrencyModal({
448448
) : state === "above_quota" ? (
449449
<div className="flex flex-col pb-3">
450450
<Paragraph variant="small" className="text-warning" spacing>
451-
Currently you can only have up to {maxQuota} extra concurrency. This is a request
452-
for {formatNumber(amountValue)}.
453-
</Paragraph>
454-
<Paragraph variant="small" className="text-warning">
455-
Send a request below to lift your current limit. We'll get back to you soon.
451+
Currently you can only have up to {maxQuota} extra concurrency. Send a request
452+
below to lift your current limit. We'll get back to you soon.
456453
</Paragraph>
457454
</div>
458455
) : (
459456
<div className="flex flex-col pb-3">
460457
<div className="grid grid-cols-2 border-b border-grid-dimmed pb-1">
461-
<Header3 className="font-normal text-text-dimmed">Purchase</Header3>
462-
<Header3 className="justify-self-end font-normal text-text-dimmed">Cost</Header3>
458+
<Header3 className="font-normal text-text-dimmed">Summary</Header3>
459+
<Header3 className="justify-self-end font-normal text-text-dimmed">Total</Header3>
460+
</div>
461+
<div className="grid grid-cols-2 pt-2">
462+
<Header3 className="pb-0 font-normal text-text-dimmed">
463+
<span className="text-text-bright">{formatNumber(extraConcurrency)}</span>{" "}
464+
current total
465+
</Header3>
466+
<Header3 className="justify-self-end font-normal text-text-bright">
467+
{formatCurrency(
468+
(extraConcurrency * concurrencyPricing.centsPerStep) /
469+
concurrencyPricing.stepSize /
470+
100,
471+
true
472+
)}
473+
</Header3>
474+
</div>
475+
<div className="grid grid-cols-2 text-xs">
476+
<span className="text-text-dimmed">
477+
({extraConcurrency / concurrencyPricing.stepSize} bundles)
478+
</span>
479+
<span className="justify-self-end text-text-dimmed">/mth</span>
463480
</div>
464481
<div className="grid grid-cols-2 pt-2">
465482
<Header3 className={cn("pb-0 font-normal", changeClassName)}>
483+
{state === "increase" ? "+" : null}
466484
{formatNumber(amountValue - extraConcurrency)}
467485
</Header3>
468486
<Header3 className={cn("justify-self-end font-normal", changeClassName)}>
487+
{state === "increase" ? "+" : null}
469488
{formatCurrency(
470489
((amountValue - extraConcurrency) * concurrencyPricing.centsPerStep) /
471490
concurrencyPricing.stepSize /
472491
100,
473-
false
492+
true
474493
)}
475494
</Header3>
476495
</div>
477496
<div className="grid grid-cols-2 text-xs">
478497
<span className="text-text-dimmed">
479498
({(amountValue - extraConcurrency) / concurrencyPricing.stepSize} bundles @{" "}
480-
{formatCurrency(concurrencyPricing.centsPerStep / 100, false)}/mth)
499+
{formatCurrency(concurrencyPricing.centsPerStep / 100, true)}/mth)
500+
</span>
501+
<span className="justify-self-end text-text-dimmed">/mth</span>
502+
</div>
503+
<div className="grid grid-cols-2 pt-2">
504+
<Header3 className="pb-0 font-normal text-text-dimmed">
505+
<span className="text-text-bright">{formatNumber(amountValue)}</span> new total
506+
</Header3>
507+
<Header3 className="justify-self-end font-normal text-text-bright">
508+
{formatCurrency(
509+
(amountValue * concurrencyPricing.centsPerStep) /
510+
concurrencyPricing.stepSize /
511+
100,
512+
true
513+
)}
514+
</Header3>
515+
</div>
516+
<div className="grid grid-cols-2 text-xs">
517+
<span className="text-text-dimmed">
518+
({amountValue / concurrencyPricing.stepSize} bundles)
481519
</span>
482520
<span className="justify-self-end text-text-dimmed">/mth</span>
483521
</div>
@@ -519,7 +557,7 @@ function PurchaseConcurrencyModal({
519557
disabled={isLoading || state === "no_change"}
520558
LeadingIcon={isLoading ? SpinnerWhite : undefined}
521559
>
522-
{`Purchase ${formatNumber(amountValue - extraConcurrency)}`}
560+
{`Purchase ${formatNumber(amountValue - extraConcurrency)} concurrency`}
523561
</Button>
524562
</>
525563
)

0 commit comments

Comments
 (0)