Browse Source

Adds search commit to commit details

- Updates button styles to match vscode
- Updates commit message text styling
main
Keith Daulton 2 years ago
parent
commit
8b5beb8910
5 changed files with 60 additions and 4 deletions
  1. +9
    -2
      src/webviews/apps/commitDetails/commitDetails.html
  2. +32
    -2
      src/webviews/apps/commitDetails/commitDetails.scss
  3. +6
    -0
      src/webviews/apps/commitDetails/commitDetails.ts
  4. +12
    -0
      src/webviews/commitDetails/commitDetailsWebviewView.ts
  5. +1
    -0
      src/webviews/commitDetails/protocol.ts

+ 9
- 2
src/webviews/apps/commitDetails/commitDetails.html View File

@ -10,8 +10,15 @@
<!-- commitDetails:choices -->
<div class="commit-detail-panel__none" id="empty" aria-hidden="true">
<p><code-icon icon="warning"></code-icon> <span>No commit selected</span></p>
<p>
<button class="button button--full" type="button" data-action="pick-commit">Pick Commit...</button>
<p class="button-container">
<span class="button-group">
<button class="button button--full" type="button" data-action="pick-commit">
Pick Commit...
</button>
<button class="button" type="button" data-action="search-commit">
<code-icon icon="search"></code-icon>
</button>
</span>
</p>
<!-- <p><button class="button button--full" type="button">Follow Open Files</button></p> -->
</div>

+ 32
- 2
src/webviews/apps/commitDetails/commitDetails.scss View File

@ -50,8 +50,9 @@ ul {
display: inline-block;
border: none;
padding: 0.4rem;
font-family: inherit;
font-size: inherit;
line-height: inherit;
line-height: 1.4;
text-align: center;
text-decoration: none;
user-select: none;
@ -71,6 +72,30 @@ ul {
&--full {
width: 100%;
}
code-icon {
pointer-events: none;
}
}
.button-container {
margin: 1rem auto 0;
text-align: left;
max-width: 30rem;
transition: max-width .2s ease-out;
}
.button-group {
display: inline-flex;
gap: 0.1rem;
width: 100%;
max-width: 30rem;
}
@media (min-width: 640px) {
.button-container {
max-width: 100%;
}
}
// webview-specific styles
@ -172,7 +197,7 @@ ul {
}
&__message {
font-size: 1.5rem;
font-size: 1.3rem;
border: 1px solid var(--color-background--lighten-15);
padding: 0.5rem;
}
@ -187,6 +212,11 @@ ul {
-webkit-box-orient: vertical;
overflow: hidden;
}
strong {
font-weight: 600;
font-size: 1.4rem;
}
}
&__commit-action {

+ 6
- 0
src/webviews/apps/commitDetails/commitDetails.ts View File

@ -12,6 +12,7 @@ import {
OpenFileOnRemoteCommandType,
PickCommitCommandType,
RichContentNotificationType,
SearchCommitCommandType,
State,
} from '../../commitDetails/protocol';
import { App } from '../shared/appBase';
@ -59,6 +60,7 @@ export class CommitDetailsApp extends App {
),
DOM.on('[data-action="commit-show-actions"]', 'click', e => this.onCommitMoreActions(e)),
DOM.on('[data-action="pick-commit"]', 'click', e => this.onPickCommit(e)),
DOM.on('[data-action="search-commit"]', 'click', e => this.onSearchCommit(e)),
DOM.on('[data-action="autolink-settings"]', 'click', e => this.onAutolinkSettings(e)),
];
@ -70,6 +72,10 @@ export class CommitDetailsApp extends App {
this.sendCommand(AutolinkSettingsCommandType, undefined);
}
onSearchCommit(_e: MouseEvent) {
this.sendCommand(SearchCommitCommandType, undefined);
}
onPickCommit(_e: MouseEvent) {
this.sendCommand(PickCommitCommandType, undefined);
}

+ 12
- 0
src/webviews/commitDetails/commitDetailsWebviewView.ts View File

@ -27,6 +27,7 @@ import {
PickCommitCommandType,
RichCommitDetails,
RichContentNotificationType,
SearchCommitCommandType,
State,
} from './protocol';
@ -87,6 +88,11 @@ export class CommitDetailsWebviewView extends WebviewViewBase {
this.showCommitPicker();
});
break;
case SearchCommitCommandType.method:
onIpc(SearchCommitCommandType, e, _params => {
this.showCommitSearch();
});
break;
case AutolinkSettingsCommandType.method:
onIpc(AutolinkSettingsCommandType, e, _params => {
this.showAutolinkSettings();
@ -103,6 +109,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase {
void executeCommand(Commands.ShowSettingsPageAndJumpToAutolinks);
}
private showCommitSearch() {
void executeCommand(Commands.SearchCommits, {
showResultsInDetails: true,
});
}
private showCommitPicker() {
void executeGitCommand({ command: 'log', state: { openPickInView: true } });
}

+ 1
- 0
src/webviews/commitDetails/protocol.ts View File

@ -39,6 +39,7 @@ export const FileComparePreviousCommandType = new IpcCommandType('co
export const FileMoreActionsCommandType = new IpcCommandType<FileParams>('commit/file/moreActions');
export const CommitActionsCommandType = new IpcCommandType<undefined>('commit/moreActions');
export const PickCommitCommandType = new IpcCommandType<undefined>('commit/pickCommit');
export const SearchCommitCommandType = new IpcCommandType<undefined>('commit/searchCommit');
export const AutolinkSettingsCommandType = new IpcCommandType<undefined>('commit/autolinkSettings');
// NOTIFICATIONS

Loading…
Cancel
Save