Skip to content

Commit 8e0eb67

Browse files
committed
Improves actions in home active section
- shows Commit via SCM when ai is disabled - secondary actions only show menu when more than one action
1 parent 4392e4e commit 8e0eb67

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

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

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
6363
.uppercase {
6464
text-transform: uppercase;
6565
}
66-
67-
menu-item {
68-
margin-inline: 0.5rem;
69-
}
7066
`,
7167
];
7268

@@ -264,29 +260,41 @@ export class GlActiveBranchCard extends GlBranchCardBase {
264260
workingTreeState.added + workingTreeState.changed + workingTreeState.deleted > 0;
265261

266262
const actions = [];
267-
268-
if (hasWip && aiEnabled) {
269-
actions.push(
270-
html`<menu-item ?disabled=${isFetching} href=${this.createCommandLink('gitlens.ai.explainWip:home')}
271-
>Explain Working Changes (Preview)</menu-item
272-
>`,
273-
);
274-
}
275-
276263
if (aiEnabled) {
264+
if (hasWip) {
265+
actions.push(
266+
html`<menu-item ?disabled=${isFetching} href=${this.createCommandLink('gitlens.ai.explainWip:home')}
267+
>Explain Working Changes (Preview)</menu-item
268+
>`,
269+
);
270+
}
271+
277272
actions.push(
278273
html`<menu-item ?disabled=${isFetching} href=${this.createCommandLink('gitlens.ai.explainBranch:home')}
279274
>Explain Branch (Preview)</menu-item
280275
>`,
281276
);
282-
}
283277

284-
if (hasWip) {
285-
actions.push(
286-
html`<menu-item ?disabled=${isFetching} href=${this.createCommandLink('gitlens.home.createCloudPatch')}
287-
>Share as Cloud Patch</menu-item
288-
>`,
289-
);
278+
if (hasWip) {
279+
actions.push(
280+
html`<menu-item
281+
?disabled=${isFetching}
282+
href=${this.createCommandLink('gitlens.home.createCloudPatch')}
283+
>Share as Cloud Patch</menu-item
284+
>`,
285+
);
286+
}
287+
} else if (hasWip) {
288+
return html`
289+
<gl-button
290+
aria-busy=${ifDefined(isFetching)}
291+
?disabled=${isFetching}
292+
href=${this.createCommandLink('gitlens.home.createCloudPatch')}
293+
appearance="secondary"
294+
tooltip="Share as Cloud Patch"
295+
><code-icon icon="gl-cloud-patch-share"></code-icon>
296+
</gl-button>
297+
`;
290298
}
291299

292300
if (actions.length === 0) return undefined;
@@ -298,7 +306,7 @@ export class GlActiveBranchCard extends GlBranchCardBase {
298306
.arrow=${false}
299307
distance="0"
300308
>
301-
<gl-button slot="anchor" appearance="toolbar" tooltipPlacement="top" tooltip="Additional Actions">
309+
<gl-button slot="anchor" appearance="toolbar" tooltipPlacement="top" aria-label="Additional Actions">
302310
<code-icon icon="ellipsis"></code-icon>
303311
</gl-button>
304312
<div slot="content">
@@ -335,10 +343,21 @@ export class GlActiveBranchCard extends GlBranchCardBase {
335343
source: 'home',
336344
})}
337345
appearance="secondary"
338-
tooltip="Generate Message &amp; Commit..."
346+
tooltip="Generate Message &amp; Commit via SCM..."
339347
><code-icon icon="sparkle" slot="prefix"></code-icon>Commit
340348
</gl-button>
341349
`);
350+
} else {
351+
actions.push(html`
352+
<gl-button
353+
aria-busy=${ifDefined(isFetching)}
354+
?disabled=${isFetching}
355+
href="command:workbench.view.scm"
356+
appearance="secondary"
357+
tooltip="Commit via SCM"
358+
><code-icon rotate="45" icon="arrow-up" slot="suffix"></code-icon>Commit
359+
</gl-button>
360+
`);
342361
}
343362
}
344363

0 commit comments

Comments
 (0)