Skip to content

Commit 1b0ec01

Browse files
MananTankjnsdls
authored andcommitted
Add charts on usage page
1 parent bfa7449 commit 1b0ec01

File tree

1 file changed

+1
-28
lines changed
  • apps/dashboard/src/app/team/[team_slug]/(team)/~/settings/billing/components

1 file changed

+1
-28
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/settings/billing/components/PlanInfoCard.tsx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ function BillingInfo({
101101
(subscription) => subscription.type === "USAGE",
102102
);
103103

104-
// only plan and usage subscriptions are considered for now
105-
const totalUsd = getAllSubscriptionsTotal(
106-
subscriptions.filter((sub) => sub.type === "PLAN" || sub.type === "USAGE"),
107-
);
108-
109104
return (
110105
<div>
111106
{planSubscription && (
@@ -124,13 +119,6 @@ function BillingInfo({
124119
/>
125120
</>
126121
)}
127-
128-
<Separator className="my-4" />
129-
130-
<div className="flex items-center justify-between gap-6">
131-
<h5 className="font-medium text-lg">Total Upcoming Bill</h5>
132-
<p className="text-foreground">{totalUsd}</p>
133-
</div>
134122
</div>
135123
);
136124
}
@@ -159,7 +147,7 @@ function SubscriptionOverview(props: {
159147
</p>
160148
</div>
161149

162-
<p className="text-muted-foreground">
150+
<p className="text-foreground">
163151
{formatCurrencyAmount(
164152
subscription.upcomingInvoice.amount || 0,
165153
subscription.upcomingInvoice.currency,
@@ -170,21 +158,6 @@ function SubscriptionOverview(props: {
170158
);
171159
}
172160

173-
function getAllSubscriptionsTotal(subscriptions: TeamSubscription[]) {
174-
let totalCents = 0;
175-
let currency = "USD";
176-
177-
for (const subscription of subscriptions) {
178-
const amount = subscription.upcomingInvoice.amount;
179-
currency = subscription.upcomingInvoice.currency;
180-
if (amount) {
181-
totalCents += amount;
182-
}
183-
}
184-
185-
return formatCurrencyAmount(totalCents, currency);
186-
}
187-
188161
function formatCurrencyAmount(centsAmount: number, currency: string) {
189162
return new Intl.NumberFormat(undefined, {
190163
style: "currency",

0 commit comments

Comments
 (0)