Skip to content

Commit 9f78187

Browse files
committed
Fixes hidden refs from getting focus when hidden
1 parent 066ac7c commit 9f78187

File tree

1 file changed

+53
-52
lines changed

1 file changed

+53
-52
lines changed

src/webviews/apps/plus/graph/graph-header.ts

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import { isSubscriptionPaid } from '../../../../plus/gk/utils/subscription.utils
1818
import type { LaunchpadCommandArgs } from '../../../../plus/launchpad/launchpad';
1919
import { createCommandLink } from '../../../../system/commands';
2020
import { debounce } from '../../../../system/decorators/debounce';
21+
import { hasTruthyKeys } from '../../../../system/object';
2122
import { createWebviewCommandLink } from '../../../../system/webview';
2223
import type {
2324
DidChooseRefParams,
2425
GraphExcludedRef,
26+
GraphExcludeRefs,
2527
GraphExcludeTypes,
2628
GraphMinimapMarkerTypes,
2729
GraphSearchResults,
@@ -938,6 +940,56 @@ export class GlGraphHeader extends SignalWatcher(LitElement) {
938940
</gl-tooltip>`;
939941
}
940942

943+
private renderHiddenRefs(excludeRefs: GraphExcludeRefs | undefined) {
944+
if (!hasTruthyKeys(excludeRefs)) return nothing;
945+
946+
return html`<gl-popover
947+
class="popover"
948+
placement="bottom-start"
949+
trigger="click focus"
950+
?arrow=${false}
951+
distance=${0}
952+
>
953+
<gl-tooltip placement="top" slot="anchor">
954+
<button type="button" id="hiddenRefs" class="action-button">
955+
<code-icon icon=${`eye-closed`}></code-icon>
956+
${Object.values(excludeRefs ?? {}).length}
957+
<code-icon class="action-button__more" icon="chevron-down" aria-hidden="true"></code-icon>
958+
</button>
959+
<span slot="content">Hidden Branches / Tags</span>
960+
</gl-tooltip>
961+
<div slot="content">
962+
<menu-label>Hidden Branches / Tags</menu-label>
963+
${when(
964+
this.excludeRefs.length > 0,
965+
() => html`
966+
${repeat(
967+
this.excludeRefs,
968+
ref => html`
969+
<menu-item
970+
@click=${(event: CustomEvent) => {
971+
this.handleOnToggleRefsVisibilityClick(event, [ref], true);
972+
}}
973+
class="flex-gap"
974+
>
975+
${this.renderRemoteAvatarOrIcon(ref)}
976+
<span>${ref.name}</span>
977+
</menu-item>
978+
`,
979+
)}
980+
<menu-item
981+
@click=${(event: CustomEvent) => {
982+
this.handleOnToggleRefsVisibilityClick(event, this.excludeRefs, true);
983+
}}
984+
>
985+
Show All
986+
</menu-item>
987+
`,
988+
)}
989+
</div>
990+
</gl-popover>`;
991+
}
992+
941993
private renderTitlebarSearchRow(repo: RepositoryShape | undefined) {
942994
if (!this.graphState.allowed) return nothing;
943995

@@ -956,58 +1008,7 @@ export class GlGraphHeader extends SignalWatcher(LitElement) {
9561008
return html`
9571009
<div class="titlebar__row">
9581010
<div class="titlebar__group">
959-
${this.renderBranchVisibility(repo)}
960-
<div class=${`shrink ${!Object.values(excludeRefs ?? {}).length && 'hidden'}`}>
961-
<gl-popover
962-
class="popover"
963-
placement="bottom-start"
964-
trigger="click focus"
965-
?arrow=${false}
966-
distance=${0}
967-
>
968-
<gl-tooltip placement="top" slot="anchor">
969-
<button type="button" id="hiddenRefs" class="action-button">
970-
<code-icon icon=${`eye-closed`}></code-icon>
971-
${Object.values(excludeRefs ?? {}).length}
972-
<code-icon
973-
class="action-button__more"
974-
icon="chevron-down"
975-
aria-hidden="true"
976-
></code-icon>
977-
</button>
978-
<span slot="content">Hidden Branches / Tags</span>
979-
</gl-tooltip>
980-
<div slot="content">
981-
<menu-label>Hidden Branches / Tags</menu-label>
982-
${when(
983-
this.excludeRefs.length > 0,
984-
() => html`
985-
${repeat(
986-
this.excludeRefs,
987-
ref => html`
988-
<menu-item
989-
@click=${(event: CustomEvent) => {
990-
this.handleOnToggleRefsVisibilityClick(event, [ref], true);
991-
}}
992-
class="flex-gap"
993-
>
994-
${this.renderRemoteAvatarOrIcon(ref)}
995-
<span>${ref.name}</span>
996-
</menu-item>
997-
`,
998-
)}
999-
<menu-item
1000-
@click=${(event: CustomEvent) => {
1001-
this.handleOnToggleRefsVisibilityClick(event, this.excludeRefs, true);
1002-
}}
1003-
>
1004-
Show All
1005-
</menu-item>
1006-
`,
1007-
)}
1008-
</div>
1009-
</gl-popover>
1010-
</div>
1011+
${this.renderBranchVisibility(repo)} ${this.renderHiddenRefs(excludeRefs)}
10111012
<gl-popover
10121013
class="popover"
10131014
placement="bottom-start"

0 commit comments

Comments
 (0)