From 3e91f365ae79721e5b006a5042203af5d584c353 Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Wed, 7 Jun 2023 18:27:38 -0400 Subject: [PATCH] Updates account state verbiage --- src/subscription.ts | 9 ++ .../plus/account/components/account-content.ts | 107 ++++++--------------- .../apps/shared/components/button-container.ts | 2 +- 3 files changed, 40 insertions(+), 78 deletions(-) diff --git a/src/subscription.ts b/src/subscription.ts index f7b4e40..7c083df 100644 --- a/src/subscription.ts +++ b/src/subscription.ts @@ -224,3 +224,12 @@ export function isSubscriptionStateTrial(state: SubscriptionState | undefined): if (state == null) return false; return state === SubscriptionState.FreeInPreviewTrial || state === SubscriptionState.FreePlusInTrial; } + +export function hasAccountFromSubscriptionState(state: SubscriptionState | undefined): boolean { + if (state == null) return false; + return ( + state !== SubscriptionState.Free && + state !== SubscriptionState.FreePreviewTrialExpired && + state !== SubscriptionState.FreeInPreviewTrial + ); +} diff --git a/src/webviews/apps/plus/account/components/account-content.ts b/src/webviews/apps/plus/account/components/account-content.ts index 9a8391a..1334ab0 100644 --- a/src/webviews/apps/plus/account/components/account-content.ts +++ b/src/webviews/apps/plus/account/components/account-content.ts @@ -1,6 +1,6 @@ import { css, html, LitElement, nothing } from 'lit'; import { customElement, property } from 'lit/decorators.js'; -import { SubscriptionState } from '../../../../../subscription'; +import { hasAccountFromSubscriptionState, SubscriptionState } from '../../../../../subscription'; import { pluralize } from '../../../../../system/string'; import { elementBase, linkBase } from '../../../shared/components/styles/lit/base.css'; import '../../../shared/components/button'; @@ -115,39 +115,10 @@ export class AccountContent extends LitElement { } get hasAccount() { - switch (this.state) { - case SubscriptionState.Free: - case SubscriptionState.FreePreviewTrialExpired: - case SubscriptionState.FreeInPreviewTrial: - return false; - } - return true; - } - - get isPro() { - switch (this.state) { - case SubscriptionState.Free: - case SubscriptionState.FreePreviewTrialExpired: - case SubscriptionState.FreePlusTrialExpired: - case SubscriptionState.VerificationRequired: - return false; - } - return true; + return hasAccountFromSubscriptionState(this.state); } private renderAccountInfo() { - if (this.state === SubscriptionState.FreeInPreviewTrial) { - return html` -
- - - -
- `; - } - if (!this.hasAccount) { return nothing; } @@ -155,25 +126,16 @@ export class AccountContent extends LitElement { return html`
- +
- `; - } - - private renderAccountNavigation() { - if (!this.hasAccount) { - return nothing; - } - - return html` - Manage Account - Manage Account + @@ -196,63 +158,54 @@ export class AccountContent extends LitElement { `; case SubscriptionState.Free: - return html` -

- A GitLens Pro subscription enables services that increase productivity, focus and collaboration. -

-

- Start a trial to access these services or - sign in. -

- - Start Free Pro Trial - -

- ☁️ A trial or subscription is required for use.
- ✨ A trial or subscription is required for use on privately hosted repos. -

- `; - + case SubscriptionState.FreeInPreviewTrial: case SubscriptionState.FreePreviewTrialExpired: return html`

- Your free 3-day Pro trial has ended, extend your free trial to get an additional 7-days, or + Sign up for access to our developer productivity and collaboration services, e.g. Workspaces, or sign in.

- Extend Free Pro Trial + Sign Up -

- ☁️ A trial or subscription is required for use.
- ✨ A trial or subscription is required for use on privately hosted repos. -

+

Signing up starts a free 7-day Pro trial.

`; case SubscriptionState.FreePlusTrialExpired: return html` -

Your Pro trial has ended, please upgrade to continue to use this on privately hosted repos.

+

+ Your Pro trial has ended, please upgrade to continue to use ✨ features on privately hosted + repos. +

Upgrade to Pro

- ☁️ A trial or subscription is required for use.
- ✨ A trial or subscription is required for use on privately hosted repos. + You only have access to ✨ features on local and publicly hosted repos and ☁️ features based on + your subscription tier.

`; - case SubscriptionState.FreeInPreviewTrial: case SubscriptionState.FreePlusInTrial: return html`

Your have ${this.daysRemaining} remaining in your Pro trial. Once your trial ends, you'll need a - paid plan to continue using ☁️ features. + paid plan to continue using ✨ features.

Upgrade to Pro

- ☁️ A trial or subscription is required for use.
- ✨ A trial or subscription is required for use on privately hosted repos. + You have access to ✨ features on privately hosted repos and ☁️ features based on the Pro tier + during your trial. +

+ `; + + case SubscriptionState.Paid: + return html` +

+ You have access to ✨ features on privately hosted repos and ☁️ features based on your + subscription tier.

`; } @@ -261,6 +214,6 @@ export class AccountContent extends LitElement { } override render() { - return html`${this.renderAccountInfo()}${this.renderAccountState()}${this.renderAccountNavigation()}`; + return html`${this.renderAccountInfo()}${this.renderAccountState()}`; } } diff --git a/src/webviews/apps/shared/components/button-container.ts b/src/webviews/apps/shared/components/button-container.ts index b6b68ec..0f6f18c 100644 --- a/src/webviews/apps/shared/components/button-container.ts +++ b/src/webviews/apps/shared/components/button-container.ts @@ -24,7 +24,7 @@ export class ButtonContainer extends LitElement { .group { display: inline-flex; - gap: 0.1rem; + gap: 0.4rem; width: 100%; max-width: 30rem; }