From cc680c9f284b5d9deb53629dfecc12af30581653 Mon Sep 17 00:00:00 2001 From: Kacper Wojciechowski <39823706+jog1t@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:22:48 +0200 Subject: [PATCH] fix: change how billing are calculated --- .../components/game-billing/game-billing-context.tsx | 1 + .../components/game-billing/game-billing-plans.tsx | 5 +++-- .../components/game-billing/game-billing-summary.tsx | 4 ++-- .../src/domains/game/data/billing-calculate-usage.ts | 10 +++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/hub/src/domains/game/components/game-billing/game-billing-context.tsx b/apps/hub/src/domains/game/components/game-billing/game-billing-context.tsx index 0bdf922c..d146d542 100644 --- a/apps/hub/src/domains/game/components/game-billing/game-billing-context.tsx +++ b/apps/hub/src/domains/game/components/game-billing/game-billing-context.tsx @@ -18,6 +18,7 @@ interface GameBillingContextValue { used: number; overage: number; remaining: number; + total: number; }; subscription: RivetEe.ee.billing.Subscription | undefined; } diff --git a/apps/hub/src/domains/game/components/game-billing/game-billing-plans.tsx b/apps/hub/src/domains/game/components/game-billing/game-billing-plans.tsx index 86284283..6e9956c3 100644 --- a/apps/hub/src/domains/game/components/game-billing/game-billing-plans.tsx +++ b/apps/hub/src/domains/game/components/game-billing/game-billing-plans.tsx @@ -18,6 +18,7 @@ import { faShield, faUpRightAndDownLeftFromCenter, } from "@rivet-gg/icons"; +import { PRICE_MAP } from "../../data/billing-calculate-usage"; import { LobbyRegionIcon, LobbyRegionName, @@ -46,7 +47,7 @@ export function GameBillingPlans({ gameId }: GameBillingPlansProps) { open({ plan: RivetEe.ee.billing.Plan.Indie, @@ -118,7 +119,7 @@ export function GameBillingPlans({ gameId }: GameBillingPlansProps) { plan: RivetEe.ee.billing.Plan.Trial, }) } - price="$29" + price={`$${PRICE_MAP[RivetEe.ee.billing.Plan.Studio]}`} type={plan === RivetEe.ee.billing.Plan.Studio ? "active" : undefined} priceLead="+ Resource Usage" features={[ diff --git a/apps/hub/src/domains/game/components/game-billing/game-billing-summary.tsx b/apps/hub/src/domains/game/components/game-billing/game-billing-summary.tsx index 56ba0b1d..18fb5d55 100644 --- a/apps/hub/src/domains/game/components/game-billing/game-billing-summary.tsx +++ b/apps/hub/src/domains/game/components/game-billing/game-billing-summary.tsx @@ -3,14 +3,14 @@ import { useGameBilling } from "./game-billing-context"; export function GameBillingSummary() { const { - credits: { overage, remaining }, + credits: { total, remaining }, } = useGameBilling(); return ( } + value={} />