Browse Source

Updates commit graph preview banner

Reworks graph preview banner storage
main
Eric Amodio 2 years ago
parent
commit
402ff592ae
4 changed files with 17 additions and 7 deletions
  1. +7
    -2
      src/plus/webviews/graph/graphWebview.ts
  2. +3
    -1
      src/storage.ts
  3. +4
    -3
      src/webviews/apps/plus/graph/GraphWrapper.tsx
  4. +3
    -1
      src/webviews/apps/plus/graph/graph.scss

+ 7
- 2
src/plus/webviews/graph/graphWebview.ts View File

@ -17,6 +17,7 @@ import type { GitRemote } from '../../../git/models/remote';
import type { Repository, RepositoryChangeEvent } from '../../../git/models/repository';
import { RepositoryChange, RepositoryChangeComparisonMode } from '../../../git/models/repository';
import type { GitTag } from '../../../git/models/tag';
import { updateRecordValue } from '../../../system/object';
import { RepositoryFolderNode } from '../../../views/nodes/viewNode';
import type { IpcMessage } from '../../../webviews/protocol';
import { onIpc } from '../../../webviews/protocol';
@ -170,7 +171,10 @@ export class GraphWebview extends WebviewBase {
private dismissPreview() {
this.previewBanner = false;
void this.container.storage.storeWorkspace('graph:preview', false);
let banners = this.container.storage.getWorkspace('graph:banners:dismissed');
banners = updateRecordValue(banners, 'preview', true);
void this.container.storage.storeWorkspace('graph:banners:dismissed', banners);
}
private changeColumn(name: string, config: GraphColumnConfig) {
@ -394,7 +398,8 @@ export class GraphWebview extends WebviewBase {
}
if (this.previewBanner == null) {
this.previewBanner = this.container.storage.getWorkspace('graph:preview') ?? true;
const banners = this.container.storage.getWorkspace('graph:banners:dismissed');
this.previewBanner = !banners?.['preview'];
}
if (this.selectedRepository === undefined) {

+ 3
- 1
src/storage.ts View File

@ -152,8 +152,10 @@ export interface WorkspaceStorage {
};
gitPath?: string;
graph: {
banners: {
dismissed?: Record<string, boolean>;
};
columns?: Record<string, GraphColumnConfig>;
preview?: boolean;
};
remote: {
default?: string;

+ 4
- 3
src/webviews/apps/plus/graph/GraphWrapper.tsx View File

@ -301,11 +301,12 @@ export function GraphWrapper({
{showBanner && (
<section className="graph-app__banner">
<div className="alert">
<span className="alert__icon codicon codicon-preview"></span>
<span className="alert__icon codicon codicon-search"></span>
<div className="alert__content">
<p className="alert__title">Preview</p>
<p className="alert__title">Preview Feature</p>
<p className="alert__message">
This is a GitLens+ feature that requires a paid account for use on private repositories.
The Commit Graph is a GitLens+ feature currently in preview. It is freely available
for local and public repos, while a paid account is required for use on private repos.
</p>
</div>
<button className="alert__action" type="button" onClick={() => handleDismissBanner()}>

+ 3
- 1
src/webviews/apps/plus/graph/graph.scss View File

@ -136,11 +136,13 @@ body {
padding-top: 0.24rem;
}
&__title {
font-size: 1.2rem;
font-size: 1.3rem;
font-weight: 700;
margin: 0;
text-transform: uppercase;
}
&__message {
font-size: 1.2rem;
margin: 0;
}

Loading…
Cancel
Save