@@ -26,6 +26,7 @@ import '../../../shared/components/skeleton-loader';
2626import '../../../shared/components/card/card' ;
2727import '../../../shared/components/commit/commit-stats' ;
2828import '../../../shared/components/menu/menu-item' ;
29+ import '../../../shared/components/menu/menu-label' ;
2930import '../../../shared/components/overlays/popover' ;
3031import '../../../shared/components/overlays/tooltip' ;
3132import '../../../shared/components/pills/tracking' ;
@@ -62,6 +63,10 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
6263 .uppercase {
6364 text-transform: uppercase;
6465 }
66+
67+ menu-item {
68+ margin-inline: 0.5rem;
69+ }
6570 ` ,
6671 ] ;
6772
@@ -250,14 +255,67 @@ export class GlActiveBranchCard extends GlBranchCardBase {
250255 ` ;
251256 }
252257
258+ private renderActionsMenu ( ) {
259+ const aiEnabled = this . _homeState . orgSettings . ai && this . _homeState . aiEnabled ;
260+ const isFetching = this . busy ;
261+ const workingTreeState = this . wip ?. workingTreeState ;
262+ const hasWip =
263+ workingTreeState != null &&
264+ workingTreeState . added + workingTreeState . changed + workingTreeState . deleted > 0 ;
265+
266+ 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+
276+ if ( aiEnabled ) {
277+ actions . push (
278+ html `< menu-item ?disabled =${ isFetching } href =${ this . createCommandLink ( 'gitlens.ai.explainBranch:home' ) }
279+ > Explain Branch (Preview)</ menu-item
280+ > ` ,
281+ ) ;
282+ }
283+
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+ ) ;
290+ }
291+
292+ if ( actions . length === 0 ) return undefined ;
293+
294+ return html `< gl-popover
295+ appearance ="menu "
296+ trigger ="click focus "
297+ placement ="bottom-end "
298+ .arrow =${ false }
299+ distance ="0"
300+ >
301+ < gl-button slot ="anchor " appearance ="toolbar " tooltipPlacement ="top " tooltip ="Additional Actions ">
302+ < code-icon icon ="ellipsis "> </ code-icon >
303+ </ gl-button >
304+ < div slot ="content ">
305+ < menu-label > Actions</ menu-label >
306+ ${ actions }
307+ </ div >
308+ </ gl-popover > ` ;
309+ }
310+
253311 private renderBranchStateActions ( ) {
254312 const { name, upstream } = this . branch ;
255313
256314 const actions : TemplateResult [ ] = [ ] ;
257315
258316 const wrappedActions = ( ) => {
259- if ( actions . length === 0 ) return undefined ;
260- return html `< div > < button-container > ${ actions } </ button-container > </ div > ` ;
317+ if ( actions . length === 0 ) return this . renderActionsMenu ( ) ;
318+ return html `< div > < button-container > ${ actions } ${ this . renderActionsMenu ( ) } </ button-container > </ div > ` ;
261319 } ;
262320
263321 const isFetching = this . busy ;
@@ -280,40 +338,8 @@ export class GlActiveBranchCard extends GlBranchCardBase {
280338 tooltip="Generate Message & Commit..."
281339 > < code-icon icon ="sparkle " slot ="prefix "> </ code-icon > Commit
282340 </ gl-button >
283- < gl-button
284- aria-busy =${ ifDefined ( isFetching ) }
285- ?disabled =${ isFetching }
286- href=${ this . createCommandLink ( 'gitlens.ai.explainWip:home' ) }
287- appearance="secondary"
288- tooltip="Explain Working Changes (Preview)"
289- > < code-icon icon ="sparkle " slot ="prefix "> </ code-icon > WIP
290- </ gl-button >
291341 ` ) ;
292342 }
293-
294- actions . push ( html `
295- < gl-button
296- aria-busy =${ ifDefined ( isFetching ) }
297- ?disabled =${ isFetching }
298- href=${ this . createCommandLink ( 'gitlens.home.createCloudPatch' ) }
299- appearance="secondary"
300- tooltip="Share as Cloud Patch"
301- > < code-icon icon ="gl-cloud-patch-share "> </ code-icon >
302- </ gl-button >
303- ` ) ;
304- }
305-
306- if ( this . _homeState . orgSettings . ai && this . _homeState . aiEnabled ) {
307- actions . push ( html `
308- < gl-button
309- aria-busy =${ ifDefined ( isFetching ) }
310- ?disabled =${ isFetching }
311- href=${ this . createCommandLink ( 'gitlens.ai.explainBranch:home' ) }
312- appearance="secondary"
313- tooltip="Explain Branch (Preview)"
314- > < code-icon icon ="sparkle " slot ="prefix "> </ code-icon > Branch
315- </ gl-button >
316- ` ) ;
317343 }
318344
319345 if ( this . wip ?. pausedOpStatus != null ) {
0 commit comments