Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

refactor(Billing): simplify shade assignment logic in ProductOverviewCard component

Victor Hugo dos Santosb50d3be46344
diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx
index 3c5f05eb9d..422b9697d0 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx
@@ -262,15 +262,10 @@ const UsageDistribution = ({
} else {
const total = breakdown.scopedCount;
const topScopes = [...breakdown.scopes].sort((a, b) => b.count - a.count).slice(0, 5);
- const subOrgShades = ["bg-sub-org/85", "bg-sub-org/60", "bg-sub-org/40", "bg-sub-org/25"];
- let subOrgIndex = 0;
- const shaded = topScopes.map((entry) => {
- const shade = entry.isRoot
- ? "bg-org/85"
- : subOrgShades[Math.min(subOrgIndex, subOrgShades.length - 1)];
- if (!entry.isRoot) subOrgIndex += 1;
- return { entry, shade };
- });
+ const shaded = topScopes.map((entry) => ({
+ entry,
+ shade: entry.isRoot ? "bg-org/85" : "bg-sub-org/85"
+ }));
const rootCount = breakdown.scopes
.filter((entry) => entry.isRoot)
.reduce((sum, entry) => sum + entry.count, 0);