diff --git a/src/webviews/apps/commitDetails/commitDetails.ts b/src/webviews/apps/commitDetails/commitDetails.ts index 1ddbe7d..b3e4fcf 100644 --- a/src/webviews/apps/commitDetails/commitDetails.ts +++ b/src/webviews/apps/commitDetails/commitDetails.ts @@ -31,6 +31,7 @@ import '../shared/components/rich/issue-pull-request'; import '../shared/components/skeleton-loader'; import '../shared/components/commit/commit-stats'; import '../shared/components/webview-pane'; +import '../shared/components/progress'; import '../shared/components/list/list-container'; import '../shared/components/list/list-item'; import '../shared/components/list/file-change-list-item'; @@ -506,6 +507,7 @@ export class CommitDetailsApp extends App> { } $el.expanded = this.state.preferences?.autolinksExpanded ?? true; + $el.loading = !state.includeRichContent; const $info = $el.querySelector('[data-region="rich-info"]'); const $autolinks = $el.querySelector('[data-region="autolinks"]'); diff --git a/src/webviews/apps/shared/components/progress.ts b/src/webviews/apps/shared/components/progress.ts new file mode 100644 index 0000000..9ae8164 --- /dev/null +++ b/src/webviews/apps/shared/components/progress.ts @@ -0,0 +1,76 @@ +import { attr, css, customElement, FASTElement, html } from '@microsoft/fast-element'; + +const template = html` + +`; + +const styles = css` + * { + box-sizing: border-box; + } + + :host { + position: absolute; + left: 0; + bottom: 0; + z-index: 5; + height: 2px; + width: 100%; + overflow: hidden; + } + + .progress-bar { + background-color: var(--vscode-progressBar-background); + display: none; + position: absolute; + left: 0; + width: 2%; + height: 2px; + } + + :host(.active) .progress-bar { + display: inherit; + } + + :host(.discrete) .progress-bar { + left: 0; + transition: width 0.1s linear; + } + + :host(.discrete.done) .progress-bar { + width: 100%; + } + + :host(.infinite) .progress-bar { + animation-name: progress; + animation-duration: 4s; + animation-iteration-count: infinite; + animation-timing-function: steps(100); + transform: translateZ(0); + } + + @keyframes progress { + 0% { + transform: translateX(0) scaleX(1); + } + + 50% { + transform: translateX(2500%) scaleX(3); + } + + to { + transform: translateX(4900%) scaleX(1); + } + } +`; + +@customElement({ name: 'progress-indicator', template: template, styles: styles }) +export class ProgressIndicator extends FASTElement { + @attr({ mode: 'reflect' }) + mode = 'infinite'; + + @attr({ mode: 'boolean' }) + active = false; +} diff --git a/src/webviews/apps/shared/components/webview-pane.ts b/src/webviews/apps/shared/components/webview-pane.ts index 79da5dd..117ee9c 100644 --- a/src/webviews/apps/shared/components/webview-pane.ts +++ b/src/webviews/apps/shared/components/webview-pane.ts @@ -25,6 +25,7 @@ export class WebviewPane extends LitElement { background-color: var(--vscode-sideBarSectionHeader-background); color: var(--vscode-sideBarSectionHeader-foreground); border-top: 1px solid var(--vscode-sideBarSectionHeader-border); + position: relative; } .header:focus-within { @@ -88,6 +89,9 @@ export class WebviewPane extends LitElement { @property({ type: Boolean, reflect: true }) expanded = false; + @property({ type: Boolean, reflect: true }) + loading = false; + renderTitle() { if (!this.collapsable) { return html`
@@ -110,7 +114,10 @@ export class WebviewPane extends LitElement { override render() { return html` -
${this.renderTitle()}
+
+ ${this.renderTitle()} + +