Browse Source

Updates graph footer content

- shows all account statuses
- removes preview badge
main
Keith Daulton 2 years ago
parent
commit
e849937ab1
2 changed files with 57 additions and 12 deletions
  1. +42
    -12
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  2. +15
    -0
      src/webviews/apps/plus/graph/graph.scss

+ 42
- 12
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -5,7 +5,7 @@ import type {
GraphPlatform, GraphPlatform,
GraphRef, GraphRef,
GraphRefGroup, GraphRefGroup,
GraphRefOptData,
GraphRefOptData,
GraphRow, GraphRow,
OnFormatCommitDateTime, OnFormatCommitDateTime,
} from '@gitkraken/gitkraken-components'; } from '@gitkraken/gitkraken-components';
@ -510,7 +510,10 @@ export function GraphWrapper({
onRefsVisibilityChange?.(refs, visible); onRefsVisibilityChange?.(refs, visible);
}; };
const handleOnDoubleClickRef = (event: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, refGroup: GraphRefGroup) => {
const handleOnDoubleClickRef = (
event: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent>,
refGroup: GraphRefGroup,
) => {
if (refGroup.length > 0) { if (refGroup.length > 0) {
onDoubleClickRef?.(refGroup[0]); onDoubleClickRef?.(refGroup[0]);
} }
@ -535,18 +538,46 @@ export function GraphWrapper({
onDismissBanner?.('trial'); 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 ( return (
<span className="mr-loose"> <span className="mr-loose">
<span className="badge">GitLens+ Trial</span> ({days < 1 ? '< 1 day' : pluralize('day', days)} left)
<span
className="badge"
title={`You have access to GitLens+ features on ${isPro ? 'any repo' : 'local & public repos'}`}
>
<span className={`repo-access${isPro ? ' is-pro' : ''}`}></span> {label}
{subText && (
<>
&nbsp;&nbsp;
<small>{subText}</small>
</>
)}
</span>
</span> </span>
); );
}; };
@ -853,8 +884,7 @@ export function GraphWrapper({
)} )}
</div> </div>
<div className="actionbar__group"> <div className="actionbar__group">
{renderTrialDays()}
<span className="badge">Preview</span>
{renderAccountState()}
<a <a
href="https://github.com/gitkraken/vscode-gitlens/discussions/2158" href="https://github.com/gitkraken/vscode-gitlens/discussions/2158"
title="Commit Graph Feedback" title="Commit Graph Feedback"

+ 15
- 0
src/webviews/apps/plus/graph/graph.scss View File

@ -13,6 +13,11 @@ a {
.badge { .badge {
font-weight: 700; font-weight: 700;
text-transform: uppercase; text-transform: uppercase;
small {
font-size: inherit;
opacity: 0.6;
}
} }
.actionbar { .actionbar {
@ -164,6 +169,16 @@ a {
} }
} }
.repo-access {
font-size: 1.1em;
margin-right: 0.2rem;
cursor: help;
&:not(.is-pro) {
filter: grayscale(1) brightness(0.7);
}
}
.column-button { .column-button {
--column-button-height: 20px; --column-button-height: 20px;

Loading…
Cancel
Save