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:
Fringg
2026-03-22 09:32:53 +03:00
parent b18f3fb211
commit 61ca5cc53d
3 changed files with 18 additions and 24 deletions

View File

@@ -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;
}