diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 771a281..1e412d6 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -18,7 +18,7 @@ import type { State, } from '../../../../plus/webviews/graph/protocol'; import type { Subscription } from '../../../../subscription'; -import { getTimeRemaining, SubscriptionState } from '../../../../subscription'; +import { getSubscriptionTimeRemaining, SubscriptionState } from '../../../../subscription'; import { pluralize } from '../../../../system/string'; export interface GraphWrapperProps extends State { @@ -240,6 +240,22 @@ export function GraphWrapper({ onDismissBanner?.('trial'); }; + const renderTrialDays = () => { + if ( + !subscriptionSnapshot || + ![SubscriptionState.FreeInPreview, SubscriptionState.FreePlusInTrial].includes(subscriptionSnapshot.state) + ) { + return; + } + + const days = getSubscriptionTimeRemaining(subscriptionSnapshot, 'days') ?? 0; + return ( + + GitLens+ Trial ({days < 1 ? '< 1 day' : pluralize('day', days)} left) + + ); + }; + const renderAlertContent = () => { if (subscriptionSnapshot == null || !isPrivateRepo) return; @@ -248,11 +264,8 @@ export function GraphWrapper({ let content; let actions; let days = 0; - if ( - [SubscriptionState.FreeInPreview, SubscriptionState.FreePlusInTrial].includes(subscriptionSnapshot.state) && - subscriptionSnapshot.previewTrial != null - ) { - days = getTimeRemaining(subscriptionSnapshot.previewTrial.expiresOn, 'days') ?? 0; + if ([SubscriptionState.FreeInPreview, SubscriptionState.FreePlusInTrial].includes(subscriptionSnapshot.state)) { + days = getSubscriptionTimeRemaining(subscriptionSnapshot, 'days') ?? 0; } switch (subscriptionSnapshot.state) { @@ -271,8 +284,8 @@ export function GraphWrapper({ GitLens+ trial - . Once your trial ends, you'll need a paid plan to continue to use the Commit Graph on this - and other private repos. + . Once your trial ends, you'll need a paid plan to continue to use GitLens+ features, + including the Commit Graph, on this and other private repos.
> ); @@ -283,18 +296,16 @@ export function GraphWrapper({ content = ( <>Extend Your GitLens+ Trial
-Sign in to extend your free trial by an additional 7-days.
++ Your free trial has ended, please sign in to extend your trial of GitLens+ features on + private repos by an additional 7-days. +
> ); actions = ( - <> - - Extend Trial - {' '} - - View Plans - - > + + Extend Trial + ); break; case SubscriptionState.FreePlusTrialExpired: @@ -304,7 +315,8 @@ export function GraphWrapper({ <>GitLens+ Trial Expired
- Upgrade your account to use the Commit Graph and other GitLens+ features on private repos. + Your free trial has ended, please upgrade your account to continue to use GitLens+ features, + including the Commit Graph, on this and other private repos.
> ); @@ -488,6 +500,7 @@ export function GraphWrapper({ )}