瀏覽代碼

Updates graph footer content

- shows all account statuses
- removes preview badge
main
Keith Daulton 2 年之前
父節點
當前提交
e849937ab1
共有 2 個檔案被更改,包括 57 行新增12 行删除
  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 查看文件

@ -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<HTMLButtonElement, globalThis.MouseEvent>, refGroup: GraphRefGroup) => {
const handleOnDoubleClickRef = (
event: React.MouseEvent<HTMLButtonElement, globalThis.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 (
<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>
);
};
@ -853,8 +884,7 @@ export function GraphWrapper({
)}
</div>
<div className="actionbar__group">
{renderTrialDays()}
<span className="badge">Preview</span>
{renderAccountState()}
<a
href="https://github.com/gitkraken/vscode-gitlens/discussions/2158"
title="Commit Graph Feedback"

+ 15
- 0
src/webviews/apps/plus/graph/graph.scss 查看文件

@ -13,6 +13,11 @@ a {
.badge {
font-weight: 700;
text-transform: uppercase;
small {
font-size: inherit;
opacity: 0.6;
}
}
.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-height: 20px;

Loading…
取消
儲存