From 30d415032557400034a1bd764cfbaa1952eb00ab Mon Sep 17 00:00:00 2001
From: nzaytsev
Date: Tue, 12 Nov 2024 14:51:43 +0700
Subject: [PATCH 1/5] Fixes new home view bugs
- listening to git updates (push/pull/commit)
- add an indication of the async task is fetching
- fix gl-button click area in case of using tooltip prop
- add tooltip to the `publish branch` action
- fix promo banner dismissal
---
.../apps/home/components/preview-banner.ts | 8 ++---
.../apps/plus/home/components/active-work.ts | 31 +++++++++++++++----
.../plus/home/components/branch-section.ts | 5 ++-
.../components/branch-threshold-filter.ts | 14 ++++++---
.../apps/plus/home/components/overview.ts | 8 +++--
src/webviews/apps/shared/components/button.ts | 1 +
src/webviews/home/homeWebview.ts | 12 ++++++-
7 files changed, 59 insertions(+), 20 deletions(-)
diff --git a/src/webviews/apps/home/components/preview-banner.ts b/src/webviews/apps/home/components/preview-banner.ts
index edde5782b74ce..030ff49f84afd 100644
--- a/src/webviews/apps/home/components/preview-banner.ts
+++ b/src/webviews/apps/home/components/preview-banner.ts
@@ -66,6 +66,10 @@ export class GlPreviewBanner extends LitElement {
private _button!: HTMLButtonElement;
override render() {
+ if (this.closed || this._state.previewCollapsed === true) {
+ return nothing;
+ }
+
if (this._state.previewEnabled === true) {
return html`
@@ -91,10 +95,6 @@ export class GlPreviewBanner extends LitElement {
`;
}
- if (this.closed || this._state.previewCollapsed === true) {
- return nothing;
- }
-
return html`
- ${when(state, () => this.renderBranchStateActions(state, upstream))}
+ ${when(state, () => this.renderBranchStateActions(state, upstream, isFetching))}
${when(pr, pr => {
return html`
@@ -179,14 +182,22 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
return html`${actions}`;
}
- private renderBranchStateActions(state?: GitTrackingState, upstream?: { name: string; missing: boolean }) {
+ private renderBranchStateActions(
+ state?: GitTrackingState,
+ upstream?: { name: string; missing: boolean },
+ isFetching?: boolean,
+ ) {
if (upstream?.missing !== false) {
+ const publishTooltip = upstream?.name ? `Publish branch to ${upstream.name}` : 'Publish branch';
return html`
Publish Branch
@@ -201,6 +212,8 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
return html`
- ${this.label}
+ ${this.label}${when(!this.isFetching, () => html` (${this.branches.length})`)}
${this.branches.map(
branch => html``,
diff --git a/src/webviews/apps/plus/home/components/branch-threshold-filter.ts b/src/webviews/apps/plus/home/components/branch-threshold-filter.ts
index 1d0cf3c901eb1..ec7523d3e820b 100644
--- a/src/webviews/apps/plus/home/components/branch-threshold-filter.ts
+++ b/src/webviews/apps/plus/home/components/branch-threshold-filter.ts
@@ -11,19 +11,22 @@ export const selectStyles = css`
background: none;
outline: none;
border: none;
- cursor: pointer;
- color: var(--color-foreground--50);
text-decoration: none !important;
font-weight: 500;
+ color: var(--color-foreground--25);
}
.select option {
color: var(--vscode-foreground);
background-color: var(--vscode-dropdown-background);
}
- .select:focus {
+ .select:not(:disabled) {
+ cursor: pointer;
+ color: var(--color-foreground--50);
+ }
+ .select:not(:disabled):focus {
outline: 1px solid var(--color-focus-border);
}
- .select:hover {
+ .select:not(:disabled):hover {
color: var(--vscode-foreground);
text-decoration: underline !important;
}
@@ -32,6 +35,7 @@ export const selectStyles = css`
export abstract class GlObjectSelect extends GlElement {
static override readonly styles = [selectStyles];
+ @property({ type: Boolean }) disabled: boolean = false;
@property({ type: String }) value?: V;
@property({ type: Array }) options?: T[];
@@ -44,7 +48,7 @@ export abstract class GlObjectSelect extends
return;
}
return html`
-