From 7a3a63038c88e6ec2e06a33171264e0a872d42ad Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Mon, 22 Aug 2022 23:22:55 -0400 Subject: [PATCH] Adds pinning commit when selecting file actions --- src/webviews/apps/commitDetails/commitDetails.scss | 23 ++++++++++++- src/webviews/apps/commitDetails/commitDetails.ts | 1 + .../commitDetails/commitDetailsWebviewView.ts | 38 +++------------------- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/webviews/apps/commitDetails/commitDetails.scss b/src/webviews/apps/commitDetails/commitDetails.scss index 18feebe..5151f58 100644 --- a/src/webviews/apps/commitDetails/commitDetails.scss +++ b/src/webviews/apps/commitDetails/commitDetails.scss @@ -205,9 +205,30 @@ ul { pointer-events: none; } + &:focus { + outline: 1px solid var(--vscode-focusBorder); + outline-offset: -1px; + } + &:hover { color: var(--vscode-foreground); - background-color: var(--color-background--lighten-15); + .vscode-dark & { + background-color: var(--color-background--lighten-15); + } + .vscode-light & { + background-color: var(--color-background--darken-15); + } + } + + &.is-active { + .vscode-dark & { + color: white; + background-color: var(--color-background--lighten-05); + } + .vscode-light & { + color: black; + background-color: var(--color-background--darken-05); + } } } diff --git a/src/webviews/apps/commitDetails/commitDetails.ts b/src/webviews/apps/commitDetails/commitDetails.ts index 3a7d019..1c1547a 100644 --- a/src/webviews/apps/commitDetails/commitDetails.ts +++ b/src/webviews/apps/commitDetails/commitDetails.ts @@ -236,6 +236,7 @@ export class CommitDetailsApp extends App> { const label = state.pinned ? 'Unpin this Commit' : 'Pin this Commit'; $el.setAttribute('aria-label', label); $el.setAttribute('title', label); + $el.classList.toggle('is-active', state.pinned); const $icon = $el.querySelector('[data-region="commit-pin"]'); $icon?.setAttribute('icon', state.pinned ? 'pinned' : 'pin'); diff --git a/src/webviews/commitDetails/commitDetailsWebviewView.ts b/src/webviews/commitDetails/commitDetailsWebviewView.ts index 70f9b9a..63a56dd 100644 --- a/src/webviews/commitDetails/commitDetailsWebviewView.ts +++ b/src/webviews/commitDetails/commitDetailsWebviewView.ts @@ -606,12 +606,8 @@ export class CommitDetailsWebviewView extends WebviewViewBase(Commands.DiffWithWorking, uri, { - // showOptions: { - // preserveFocus: true, - // preview: true, - // }, - // }); } private async openFileComparisonWithPrevious(params: FileActionParams) { @@ -641,23 +630,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase(Commands.DiffWithPrevious, uri, { - // commit: this._context.commit, - // line: line, - // showOptions: { - // preserveFocus: true, - // preview: true, - // ...params.showOptions, - // }, - // }); } private async openFile(params: FileActionParams) { @@ -666,14 +644,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase(Commands.OpenFileOnRemote, uri, { - // sha: this.commit?.sha, - // }); } }