浏览代码

Removes preview banner from commit graph

main
Keith Daulton 2 年前
父节点
当前提交
fef1090a85
共有 3 个文件被更改,包括 17 次插入59 次删除
  1. +2
    -9
      src/plus/webviews/graph/graphWebview.ts
  2. +1
    -2
      src/plus/webviews/graph/protocol.ts
  3. +14
    -48
      src/webviews/apps/plus/graph/GraphWrapper.tsx

+ 2
- 9
src/plus/webviews/graph/graphWebview.ts 查看文件

@ -209,7 +209,6 @@ export class GraphWebview extends WebviewBase {
private _theme: ColorTheme | undefined;
private _repositoryEventsDisposable: Disposable | undefined;
private previewBanner?: boolean;
private trialBanner?: boolean;
constructor(container: Container) {
@ -547,9 +546,7 @@ export class GraphWebview extends WebviewBase {
}
private dismissBanner(e: DismissBannerParams) {
if (e.key === 'preview') {
this.previewBanner = false;
} else if (e.key === 'trial') {
if (e.key === 'trial') {
this.trialBanner = false;
}
@ -1300,11 +1297,8 @@ export class GraphWebview extends WebviewBase {
private async getState(deferRows?: boolean): Promise<State> {
if (this.container.git.repositoryCount === 0) return { allowed: true, repositories: [] };
if (this.previewBanner == null || this.trialBanner == null) {
if (this.trialBanner == null) {
const banners = this.container.storage.getWorkspace('graph:banners:dismissed');
if (this.previewBanner == null) {
this.previewBanner = !banners?.['preview'];
}
if (this.trialBanner == null) {
this.trialBanner = !banners?.['trial'];
}
@ -1355,7 +1349,6 @@ export class GraphWebview extends WebviewBase {
const columns = this.getColumns();
return {
previewBanner: this.previewBanner,
trialBanner: this.trialBanner,
repositories: formatRepositories(this.container.git.openRepositories),
selectedRepository: this.repository.path,

+ 1
- 2
src/plus/webviews/graph/protocol.ts 查看文件

@ -53,7 +53,6 @@ export interface State {
config?: GraphComponentConfig;
context?: GraphContexts;
nonce?: string;
previewBanner?: boolean;
trialBanner?: boolean;
workingTreeStats?: GraphWorkingTreeStats;
searchResults?: DidSearchParams['results'];
@ -180,7 +179,7 @@ export const UpdateRefsVisibilityCommandType = new IpcCommandType
);
export interface DoubleClickedRefParams {
ref: GraphRef
ref: GraphRef;
}
export const DoubleClickedRefCommandType = new IpcCommandType<DoubleClickedRefParams>('graph/ref/doubleclick');

+ 14
- 48
src/webviews/apps/plus/graph/GraphWrapper.tsx 查看文件

@ -179,8 +179,6 @@ export function GraphWrapper({
const [pagingHasMore, setPagingHasMore] = useState(state.paging?.hasMore ?? false);
const [isLoading, setIsLoading] = useState(state.loading);
const [styleProps, setStyleProps] = useState(state.theming);
// banner
const [showPreview, setShowPreview] = useState(state.previewBanner);
// account
const [showAccount, setShowAccount] = useState(state.trialBanner);
const [isAccessAllowed, setIsAccessAllowed] = useState(state.allowed ?? false);
@ -528,11 +526,6 @@ export function GraphWrapper({
onSelectionChange?.(rows);
};
const handleDismissPreview = () => {
setShowPreview(false);
onDismissBanner?.('preview');
};
const handleDismissAccount = () => {
setShowAccount(false);
onDismissBanner?.('trial');
@ -675,53 +668,26 @@ export function GraphWrapper({
}
return (
<div className={`alert${modifier !== '' ? ` alert--${modifier}` : ''}`}>
<span className={`alert__icon codicon codicon-${icon}`}></span>
<div className="alert__content">
{content}
{actions && <div className="alert__actions">{actions}</div>}
<section className="graph-app__banners">
<div className={`alert${modifier !== '' ? ` alert--${modifier}` : ''}`}>
<span className={`alert__icon codicon codicon-${icon}`}></span>
<div className="alert__content">
{content}
{actions && <div className="alert__actions">{actions}</div>}
</div>
{isAccessAllowed && (
<button className="alert__dismiss" type="button" onClick={() => handleDismissAccount()}>
<span className="codicon codicon-chrome-close"></span>
</button>
)}
</div>
{isAccessAllowed && (
<button className="alert__dismiss" type="button" onClick={() => handleDismissAccount()}>
<span className="codicon codicon-chrome-close"></span>
</button>
)}
</div>
</section>
);
};
return (
<>
<section className="graph-app__banners">
{showPreview && (
<div className="alert">
<span className="alert__icon codicon codicon-eye"></span>
<div className="alert__content">
<p className="alert__title">GitLens+ Feature Preview</p>
<p className="alert__message">
The Commit Graph is currently in preview. It will always be freely available for local
and public repos, while private repos require a paid plan.
</p>
<p className="alert__accent">
<span className="codicon codicon-feedback alert__accent-icon" /> Join the{' '}
<a href="https://github.com/gitkraken/vscode-gitlens/discussions/2158">
discussion on GitHub
</a>
! We'd love to hear from you.
</p>
<p className="alert__accent">
<span className="glicon glicon-clock alert__accent-icon" /> GitLens+{' '}
<a href="command:gitlens.plus.purchase">introductory pricing</a> will end with the next
release (late Sept, early Oct).
</p>
</div>
<button className="alert__dismiss" type="button" onClick={() => handleDismissPreview()}>
<span className="codicon codicon-chrome-close"></span>
</button>
</div>
)}
{renderAlertContent()}
</section>
{renderAlertContent()}
{isAccessAllowed && (
<header className="titlebar graph-app__header">
<div className="titlebar__group">

正在加载...
取消
保存