@@ -130,19 +130,17 @@ export const branchCardStyles = css`
130
130
gap: 0.6rem;
131
131
}
132
132
133
- /*
134
- .branch-item__actions {
133
+ .branch-item__collapsed-actions {
135
134
position: absolute;
136
135
right: 0.4rem;
137
136
bottom: 0.4rem;
138
137
padding: 0.2rem 0.4rem;
139
138
background-color: var(--gl-card-hover-background);
140
139
}
141
140
142
- .branch-item:not(:focus-within):not(:hover) .branch-item__actions {
141
+ .branch-item:not(:focus-within):not(:hover) .branch-item__collapsed-actions {
143
142
${ srOnlyStyles }
144
143
}
145
- */
146
144
147
145
.pill {
148
146
--gl-pill-border: color-mix(in srgb, transparent 80%, var(--color-foreground));
@@ -623,6 +621,16 @@ export abstract class GlBranchCardBase extends GlElement {
623
621
return html `< action-nav > ${ actions } </ action-nav > ` ;
624
622
}
625
623
624
+ protected abstract getCollapsedActions ( ) : TemplateResult [ ] ;
625
+ protected renderCollapsedActions ( ) : TemplateResult | NothingType {
626
+ if ( this . expanded ) return nothing ;
627
+
628
+ const actions = this . getCollapsedActions ?.( ) ;
629
+ if ( ! actions ?. length ) return nothing ;
630
+
631
+ return html `< action-nav class ="branch-item__collapsed-actions "> ${ actions } </ action-nav > ` ;
632
+ }
633
+
626
634
protected createCommandLink < T > ( command : GlCommands , args ?: T | any ) : string {
627
635
return createCommandLink < T > ( command , args ?? this . branchRef ) ;
628
636
}
@@ -843,10 +851,35 @@ export class GlBranchCard extends GlBranchCardBase {
843
851
< div class ="branch-item__container ">
844
852
${ this . renderBranchItem ( this . renderBranchActions ( ) ) } ${ this . renderPrItem ( ) } ${ this . renderIssuesItem ( ) }
845
853
</ div >
854
+ ${ this . renderCollapsedActions ( ) }
846
855
</ gl-card >
847
856
` ;
848
857
}
849
858
859
+ protected getCollapsedActions ( ) : TemplateResult [ ] {
860
+ const actions = [ ] ;
861
+
862
+ if ( this . branch . worktree ) {
863
+ actions . push (
864
+ html `< action-item
865
+ label ="Open Worktree "
866
+ icon ="browser "
867
+ href =${ this . createCommandLink ( 'gitlens.home.openWorktree' ) }
868
+ > </ action-item > ` ,
869
+ ) ;
870
+ } else {
871
+ actions . push (
872
+ html `< action-item
873
+ label ="Switch to Branch... "
874
+ icon ="gl-switch "
875
+ href =${ this . createCommandLink ( 'gitlens.home.switchToBranch' ) }
876
+ > </ action-item > ` ,
877
+ ) ;
878
+ }
879
+
880
+ return actions ;
881
+ }
882
+
850
883
protected getBranchActions ( ) : TemplateResult [ ] {
851
884
const actions = [ ] ;
852
885
0 commit comments