Skip to content

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

style: adjust product color for metering bars

Scott Wilson285848f6709c
diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
index 1a25bfef24..8688072c39 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
@@ -257,7 +257,14 @@ const PlanCard = ({
};
// "Your current usage" panel for an active product: the recurring headline plus a bar per dimension.
-const CurrentUsageCard = ({ entitlement }: { entitlement: BillingV2Entitlement }) => {
+const CurrentUsageCard = ({
+ entitlement,
+ color
+}: {
+ entitlement: BillingV2Entitlement;
+ // The product's catalog color, threaded through to the dimension meters.
+ color: string;
+}) => {
const dims = entitlement.dimensions ?? [];
return (
<div className="flex flex-col gap-3.5 rounded-xl border border-border bg-card p-[18px]">
@@ -271,7 +278,7 @@ const CurrentUsageCard = ({ entitlement }: { entitlement: BillingV2Entitlement }
{dims.length > 0 && (
<div className="flex flex-col gap-3">
{dims.map((dim) => (
- <DimensionMeter key={dim.key} dim={dim} />
+ <DimensionMeter key={dim.key} dim={dim} color={color} />
))}
</div>
)}
@@ -504,7 +511,9 @@ export const ProductSheet = ({
</SheetHeader>
<div className="flex flex-1 flex-col gap-6 overflow-y-auto p-5">
- {entitled && entitlement && <CurrentUsageCard entitlement={entitlement} />}
+ {entitled && entitlement && (
+ <CurrentUsageCard entitlement={entitlement} color={prod.color} />
+ )}
<div className={`grid gap-3.5 ${gridCols}`}>
{plans.map((plan) => (
diff --git a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx
index b01e1b8364..1ce6da555d 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/cards/ProductsCard.tsx
@@ -159,9 +159,9 @@ const ActiveProductCard = ({ prod, entitlement, readOnly, onManage }: ActiveProd
{sortedDims.length > 0 && (
<div className="flex flex-col gap-2.5">
{sortedDims.map((dim) => (
- <DimensionMeter key={dim.key} dim={dim} hideLegend />
+ <DimensionMeter key={dim.key} dim={dim} color={prod.color} hideLegend />
))}
- <DimensionRateLegend dims={sortedDims} />
+ <DimensionRateLegend dims={sortedDims} color={prod.color} />
</div>
)}
</div>
diff --git a/frontend/src/pages/organization/BillingV2Page/components/shared.tsx b/frontend/src/pages/organization/BillingV2Page/components/shared.tsx
index 15fe5c2272..bab5fabb71 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/shared.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/shared.tsx
@@ -117,9 +117,20 @@ export const CostSummaryRow = ({
</Item>
);
+// Committed usage (meter fill + legend dot) takes the product's catalog tint, the same source as
+// ProductIcon, at the 85% strength the old static token used. On-demand keeps the warning token:
+// it flags overage cost, not product identity.
+const committedTint = (color: string) => `color-mix(in srgb, ${color} 85%, transparent)`;
+
// Rate legend for annually-committed dimensions. DimensionMeter renders it per dim by default; a
// caller can hideLegend the meters and render one combined legend for the block.
-export const DimensionRateLegend = ({ dims }: { dims: BillingV2EntitlementDim[] }) => {
+export const DimensionRateLegend = ({
+ dims,
+ color
+}: {
+ dims: BillingV2EntitlementDim[];
+ color: string;
+}) => {
const entries = dims.filter(
(dim) =>
dimAnnualCommitted(dim) && (dim.committedRate !== undefined || dim.onDemandRate !== undefined)
@@ -133,7 +144,10 @@ export const DimensionRateLegend = ({ dims }: { dims: BillingV2EntitlementDim[]
<Fragment key={dim.key}>
{dim.committedRate !== undefined && (
<span className="flex items-center gap-1.5">
- <span className="size-2 rounded-full bg-primary/85" />
+ <span
+ className="size-2 rounded-full"
+ style={{ background: committedTint(color) }}
+ />
Committed {`${fmtMoney(dim.committedRate)} / ${dim.noun} /yr`}
</span>
)}
@@ -151,6 +165,8 @@ export const DimensionRateLegend = ({ dims }: { dims: BillingV2EntitlementDim[]
type DimensionMeterProps = {
dim: BillingV2EntitlementDim;
+ // The product's catalog color; the committed fill and legend dot derive from it (like ProductIcon).
+ color: string;
// Suppress the per-dimension rate legend (the caller renders a combined DimensionRateLegend).
hideLegend?: boolean;
};
@@ -158,7 +174,7 @@ type DimensionMeterProps = {
// One usage line for a product dimension: an annual committed dimension shows committed fill plus
// on-demand overflow with a rate legend; a capped dimension a single used/limit fill; an uncapped
// one just its cost line, no bar.
-export const DimensionMeter = ({ dim, hideLegend }: DimensionMeterProps) => {
+export const DimensionMeter = ({ dim, color, hideLegend }: DimensionMeterProps) => {
const committed = dimAnnualCommitted(dim);
const { committedPct, onDemandPct } = dimBarSegments(dim);
const onDemandQty = dimOnDemandQuantity(dim);
@@ -203,11 +219,8 @@ export const DimensionMeter = ({ dim, hideLegend }: DimensionMeterProps) => {
<div className="flex h-[5px] w-full gap-0.5 overflow-hidden rounded-xs bg-border">
{/* Segments keep the soft outer corner but sit square against each other at the joint. */}
<div
- className={cn(
- "h-full rounded-xs bg-primary/85 transition-all",
- onDemandPct > 0 && "rounded-r-none"
- )}
- style={{ width: `${committedPct}%` }}
+ className={cn("h-full rounded-xs transition-all", onDemandPct > 0 && "rounded-r-none")}
+ style={{ width: `${committedPct}%`, background: committedTint(color) }}
/>
{onDemandPct > 0 && (
<div
@@ -217,7 +230,7 @@ export const DimensionMeter = ({ dim, hideLegend }: DimensionMeterProps) => {
)}
</div>
)}
- {committed && !hideLegend && <DimensionRateLegend dims={[dim]} />}
+ {committed && !hideLegend && <DimensionRateLegend dims={[dim]} color={color} />}
</div>
);
};