From e849937ab10bd7ad17eda538edabe8dd7ed9f067 Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Fri, 14 Oct 2022 01:13:16 -0400 Subject: [PATCH] Updates graph footer content - shows all account statuses - removes preview badge --- src/webviews/apps/plus/graph/GraphWrapper.tsx | 54 +++++++++++++++++++++------ src/webviews/apps/plus/graph/graph.scss | 15 ++++++++ 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 4b1d141..8967feb 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -5,7 +5,7 @@ import type { GraphPlatform, GraphRef, GraphRefGroup, - GraphRefOptData, + GraphRefOptData, GraphRow, OnFormatCommitDateTime, } from '@gitkraken/gitkraken-components'; @@ -510,7 +510,10 @@ export function GraphWrapper({ onRefsVisibilityChange?.(refs, visible); }; - const handleOnDoubleClickRef = (event: React.MouseEvent, refGroup: GraphRefGroup) => { + const handleOnDoubleClickRef = ( + event: React.MouseEvent, + refGroup: GraphRefGroup, + ) => { if (refGroup.length > 0) { onDoubleClickRef?.(refGroup[0]); } @@ -535,18 +538,46 @@ export function GraphWrapper({ onDismissBanner?.('trial'); }; - const renderTrialDays = () => { - if ( - !subscription || - ![SubscriptionState.FreeInPreviewTrial, SubscriptionState.FreePlusInTrial].includes(subscription.state) - ) { - return; + const renderAccountState = () => { + if (!subscription) return; + + let label = subscription.plan.effective.name; + let isPro = true; + let subText; + switch (subscription.state) { + case SubscriptionState.Free: + case SubscriptionState.FreePreviewTrialExpired: + case SubscriptionState.FreePlusTrialExpired: + isPro = false; + label = 'GitLens Free'; + break; + case SubscriptionState.FreeInPreviewTrial: + case SubscriptionState.FreePlusInTrial: { + const days = getSubscriptionTimeRemaining(subscription, 'days') ?? 0; + label = 'GitLens Pro (Trial)'; + subText = `${days < 1 ? '< 1 day' : pluralize('day', days)} left`; + break; + } + case SubscriptionState.VerificationRequired: + isPro = false; + label = `${label} (Unverified)`; + break; } - const days = getSubscriptionTimeRemaining(subscription, 'days') ?? 0; return ( - GitLens+ Trial ({days < 1 ? '< 1 day' : pluralize('day', days)} left) + + {label} + {subText && ( + <> +    + {subText} + + )} + ); }; @@ -853,8 +884,7 @@ export function GraphWrapper({ )}
- {renderTrialDays()} - Preview + {renderAccountState()}