Skip to content

Commit a82f269

Browse files
committed
Modifies issue row when no issue is associated with the active branch
(#4332, #4349)
1 parent 8056444 commit a82f269

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/webviews/apps/plus/home/components/active-work.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { css, html, LitElement, nothing } from 'lit';
55
import { customElement, state } from 'lit/decorators.js';
66
import { ifDefined } from 'lit/directives/if-defined.js';
77
import { isSubscriptionTrialOrPaidFromState } from '../../../../../plus/gk/utils/subscription.utils';
8+
import type { AssociateIssueWithBranchCommandArgs } from '../../../../../plus/startWork/startWork';
89
import { createCommandLink } from '../../../../../system/commands';
910
import { createWebviewCommandLink } from '../../../../../system/webview';
1011
import type {
@@ -231,6 +232,11 @@ export class GlActiveBranchCard extends GlBranchCardBase {
231232
flex-direction: column;
232233
gap: 0.8rem;
233234
}
235+
236+
span.branch-item__missing {
237+
color: var(--vscode-descriptionForeground);
238+
font-style: italic;
239+
}
234240
`,
235241
];
236242

@@ -511,4 +517,30 @@ export class GlActiveBranchCard extends GlBranchCardBase {
511517
protected getCollapsedActions(): TemplateResult[] {
512518
return [];
513519
}
520+
521+
protected override renderIssuesItem(): TemplateResult | NothingType {
522+
const issues = [...(this.issues ?? []), ...(this.autolinks ?? [])];
523+
if (!issues.length) {
524+
if (!this.expanded) return nothing;
525+
526+
return html`<div class="branch-item__row" full>
527+
<span class="branch-item__missing" full>Current work item</span>
528+
<gl-tooltip hoist content="Associate an issue">
529+
<a
530+
href=${this.createCommandLink<AssociateIssueWithBranchCommandArgs>(
531+
'gitlens.associateIssueWithBranch',
532+
{
533+
branch: this.branch.reference,
534+
source: 'home',
535+
},
536+
)}
537+
><span class="branch-item__icon"> <issue-icon></issue-icon> </span
538+
></a>
539+
</gl-tooltip>
540+
</div>`;
541+
}
542+
return super.renderIssuesItem();
543+
}
514544
}
545+
546+
type NothingType = typeof nothing;

0 commit comments

Comments
 (0)