浏览代码

Removes sidebar banner from commit details

main
Eric Amodio 1年前
父节点
当前提交
93f2b01a2e
共有 5 个文件被更改,包括 2 次插入98 次删除
  1. +2
    -2
      src/constants.ts
  2. +0
    -52
      src/webviews/apps/commitDetails/commitDetails.html
  3. +0
    -26
      src/webviews/apps/commitDetails/commitDetails.ts
  4. +0
    -15
      src/webviews/commitDetails/commitDetailsWebview.ts
  5. +0
    -3
      src/webviews/commitDetails/protocol.ts

+ 2
- 2
src/constants.ts 查看文件

@ -3,7 +3,6 @@ import type { Environment } from './container';
import type { StoredSearchQuery } from './git/search';
import type { Subscription } from './subscription';
import type { TrackedUsage, TrackedUsageKeys } from './telemetry/usageTracker';
import type { CommitDetailsDismissed } from './webviews/commitDetails/protocol';
import type { CompletedActions } from './webviews/home/protocol';
export const extensionPrefix = 'gitlens';
@ -591,6 +590,8 @@ export type DeprecatedGlobalStorage = {
'confirm:sendToOpenAI': boolean;
/** @deprecated not longer valid */
'views:layout': 'gitlens' | 'scm';
/** @deprecated not longer used */
'views:commitDetails:dismissed': 'sidebar'[];
} & {
/** @deprecated */
[key in `disallow:connection:${string}`]: any;
@ -620,7 +621,6 @@ export type GlobalStorage = {
// Keep the pre-release version separate from the released version
preVersion: string;
'views:welcome:visible': boolean;
'views:commitDetails:dismissed': CommitDetailsDismissed[];
} & { [key in `confirm:ai:tos:${AIProviders}`]: boolean } & {
[key in `provider:authentication:skip:${string}`]: boolean;
};

+ 0
- 52
src/webviews/apps/commitDetails/commitDetails.html 查看文件

@ -55,58 +55,6 @@
<p>To best take advantage of this view, we highly recommend moving it to the Secondary Side Bar.</p> -->
</div>
<main class="commit-details commit-detail-panel__main" id="main" tabindex="-1">
<div class="commit-banner" data-region="sidebar-banner">
<code-icon class="commit-banner__icon" icon="layout-sidebar-right"></code-icon>
<div class="commit-banner__message">
<h2>Move into Secondary Side Bar</h2>
<p>For a better experience, drag and drop this view into the Secondary Side Bar.</p>
</div>
<svg
class="svg-themed commit-banner__media"
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 101 49"
>
<g opacity=".2" stroke="#E6E8FA" class="svg-themed__outline">
<rect x=".5" y=".5" width="99.45" height="48" rx="2.5" />
<path d="M82 0v49M15.66 0v49M1.23 35.02h15.92" />
</g>
<rect
x="6.5"
y="29.5"
width="19"
height="14"
rx=".5"
fill="#2E3346"
stroke="#91D3FF"
class="svg-themed__view"
/>
<rect
x="85.5"
y="4.5"
width="11"
height="41"
rx=".5"
fill="#2E3346"
stroke="#91D3FF"
stroke-dasharray="2 2"
class="svg-themed__view"
/>
<path
d="M22.33 31a2.67 2.67 0 1 0 5.34 0 2.67 2.67 0 0 0-5.34 0ZM76 7l-5.09-2.73.18 5.77L76 7ZM25.42 31.28c4.91-7.46 20.77-22.07 46.1-23.64l-.05-1c-25.7 1.59-41.82 16.4-46.89 24.08l.84.56Z"
fill="#91D3FF"
class="svg-themed__line"
/>
</svg>
<a
class="commit-banner__icon commit-action"
href="#"
data-action="dismiss-banner"
aria-label="Dismiss"
title="Dismiss"
><code-icon icon="chrome-close"></code-icon
></a>
</div>
<div class="commit-details__top">
<div class="commit-details__top-menu">
<div class="commit-details__actionbar">

+ 0
- 26
src/webviews/apps/commitDetails/commitDetails.ts 查看文件

@ -72,7 +72,6 @@ export class CommitDetailsApp extends App> {
DOM.on<FileChangeListItem, FileChangeListItemDetail>('file-change-list-item', 'file-more-actions', e =>
this.onFileMoreActions(e.detail),
),
DOM.on('[data-action="dismiss-banner"]', 'click', e => this.onDismissBanner(e)),
DOM.on('[data-action="commit-actions"]', 'click', e => this.onCommitActions(e)),
DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)),
DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)),
@ -181,19 +180,6 @@ export class CommitDetailsApp extends App> {
}
}
onDismissBanner(e: MouseEvent) {
const dismissed = this.state.preferences?.dismissed ?? [];
if (dismissed.includes('sidebar')) {
return;
}
dismissed.push('sidebar');
this.state.preferences = { ...this.state.preferences, dismissed: dismissed };
const parent = (e.target as HTMLElement)?.closest<HTMLElement>('[data-region="sidebar-banner"]') ?? undefined;
this.renderBanner(this.state as CommitState, parent);
this.sendCommand(PreferencesCommandType, { dismissed: dismissed });
}
private onToggleFilesLayout(e: MouseEvent) {
const layout = ((e.target as HTMLElement)?.dataset.switchList as ViewFilesLayout) ?? undefined;
if (layout === this.state.preferences?.files?.layout) return;
@ -301,7 +287,6 @@ export class CommitDetailsApp extends App> {
renderContent() {
if (!this.renderCommit(this.state)) return;
this.renderBanner(this.state);
this.renderActions(this.state);
this.renderNavigation(this.state);
this.renderPin(this.state);
@ -326,17 +311,6 @@ export class CommitDetailsApp extends App> {
$explanation.innerHTML = '';
}
renderBanner(state: CommitState, target?: HTMLElement) {
if (!state.preferences?.dismissed?.includes('sidebar')) {
return;
}
if (!target) {
target = document.querySelector<HTMLElement>('[data-region="sidebar-banner"]') ?? undefined;
}
target?.remove();
}
renderActions(state: CommitState) {
const isUncommitted = state.selected?.sha === uncommittedSha;
const isHiddenForUncommitted = isUncommitted.toString();

+ 0
- 15
src/webviews/commitDetails/commitDetailsWebview.ts 查看文件

@ -106,20 +106,12 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
private readonly host: WebviewController<State, Serialized<State>>,
private readonly options: { mode: 'default' | 'graph' },
) {
let dismissed = this.container.storage.get('views:commitDetails:dismissed');
if (options.mode === 'graph') {
if (dismissed == null) {
dismissed = ['sidebar'];
}
}
this._context = {
pinned: false,
commit: undefined,
preferences: {
autolinksExpanded: this.container.storage.getWorkspace('views:commitDetails:autolinksExpanded'),
avatars: configuration.get('views.commitDetails.avatars'),
dismissed: dismissed,
files: configuration.get('views.commitDetails.files'),
},
richStateLoaded: false,
@ -622,7 +614,6 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
if (
this._context.preferences?.autolinksExpanded === preferences.autolinksExpanded &&
this._context.preferences?.avatars === preferences.avatars &&
this._context.preferences?.dismissed === preferences.dismissed &&
this._context.preferences?.files === preferences.files &&
this._context.preferences?.files?.compact === preferences.files?.compact &&
this._context.preferences?.files?.icon === preferences.files?.icon &&
@ -655,12 +646,6 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
changes.avatars = preferences.avatars;
}
if (preferences.dismissed != null && this._context.preferences?.dismissed !== preferences.dismissed) {
void this.container.storage.store('views:commitDetails:dismissed', preferences.dismissed);
changes.dismissed = preferences.dismissed;
}
if (preferences.files != null && this._context.preferences?.files !== preferences.files) {
if (this._context.preferences?.files?.compact !== preferences.files?.compact) {
void configuration.updateEffective('views.commitDetails.files.compact', preferences.files?.compact);

+ 0
- 3
src/webviews/commitDetails/protocol.ts 查看文件

@ -11,7 +11,6 @@ import { IpcCommandType, IpcNotificationType } from '../protocol';
export const messageHeadlineSplitterToken = '\x00\n\x00';
export type FileShowOptions = TextDocumentShowOptions;
export type CommitDetailsDismissed = 'sidebar';
export interface CommitSummary {
sha: string;
@ -33,7 +32,6 @@ export interface CommitDetails extends CommitSummary {
export interface Preferences {
autolinksExpanded?: boolean;
avatars?: boolean;
dismissed?: CommitDetailsDismissed[];
files?: Config['views']['commitDetails']['files'];
}
@ -100,7 +98,6 @@ export const NavigateCommitCommandType = new IpcCommandType('com
export interface PreferenceParams {
autolinksExpanded?: boolean;
avatars?: boolean;
dismissed?: CommitDetailsDismissed[];
files?: Config['views']['commitDetails']['files'];
}
export const PreferencesCommandType = new IpcCommandType<PreferenceParams>('commit/preferences');

正在加载...
取消
保存