mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix: fallback to referral role fill color when subscription_status is null
When subscription_status is not available (backend not deployed or user has no subscription), fill color now falls through to referral role (partner/topReferrer/activeReferrer) before defaulting to campaign/regular. Increases border size from 0.25 to 0.35 and merges legend sections.
This commit is contained in:
@@ -37,13 +37,21 @@ export function getSubscriptionStatusColor(status: SubscriptionStatus): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill color = subscription status (primary concern for campaign evaluation).
|
||||
* Fill color priority:
|
||||
* 1. Subscription status (when available)
|
||||
* 2. Referral role (when no subscription data — keeps visual differentiation)
|
||||
* 3. Campaign user / regular fallback
|
||||
*/
|
||||
export function getNodeFillColor(
|
||||
subscriptionStatus: SubscriptionStatus | null,
|
||||
campaignId: number | null,
|
||||
directReferrals: number = 0,
|
||||
isPartner: boolean = false,
|
||||
): string {
|
||||
if (subscriptionStatus) return SUBSCRIPTION_STATUS_COLOR[subscriptionStatus];
|
||||
if (isPartner) return NODE_COLORS.partner;
|
||||
if (directReferrals >= 10) return NODE_COLORS.topReferrer;
|
||||
if (directReferrals >= 1) return NODE_COLORS.activeReferrer;
|
||||
if (campaignId !== null) return NODE_COLORS.campaignUser;
|
||||
return NODE_COLORS.regular;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user