@@ -13,6 +13,7 @@ import type { File } from './gl-details-base';
13
13
import { GlDetailsBase } from './gl-details-base' ;
14
14
import type { GenerateState } from './gl-inspect-patch' ;
15
15
import '../../shared/components/button' ;
16
+ import '../../shared/components/button-container' ;
16
17
import '../../shared/components/code-icon' ;
17
18
import '../../shared/components/panes/pane-group' ;
18
19
import '../../shared/components/pills/tracking' ;
@@ -127,41 +128,33 @@ export class GlWipDetails extends GlDetailsBase {
127
128
128
129
if ( this . preferences ?. aiEnabled && this . orgSettings ?. ai ) {
129
130
return html `< div class ="section section--actions ">
130
- < p class ="button-container ">
131
- < span class ="button-group button-group--single ">
132
- < gl-button
133
- full
134
- .href =${ createCommandLink ( 'gitlens.ai.generateCommits' , {
135
- repoPath : this . wip ?. repo . path ,
136
- source : { source : 'inspect' } ,
137
- } as GenerateCommitsCommandArgs ) }
138
- tooltip ="Generate Commits with AI (Preview) — organize working changes into meaningful commits"
139
- .tooltipPlacement=${ 'top' }
140
- > Commit with AI (Preview)< code-icon icon ="sparkle " slot ="prefix "> </ code-icon
141
- > </ gl-button >
142
- </ span >
143
- </ p >
144
- < p class ="button-container ">
145
- < span class ="button-group button-group--single ">
146
- < gl-button appearance ="secondary " full href ="command:workbench.view.scm "
147
- > Commit via SCM < code-icon rotate ="45 " icon ="arrow-up " slot ="prefix "> </ code-icon
148
- > </ gl-button >
149
- </ span >
150
- </ p >
131
+ < button-container >
132
+ < gl-button
133
+ full
134
+ .href =${ createCommandLink ( 'gitlens.ai.generateCommits' , {
135
+ repoPath : this . wip ?. repo . path ,
136
+ source : { source : 'inspect' } ,
137
+ } as GenerateCommitsCommandArgs ) }
138
+ tooltip ="Generate Commits with AI (Preview) — organize working changes into meaningful commits"
139
+ .tooltipPlacement=${ 'top' }
140
+ > Commit with AI (Preview)< code-icon icon ="sparkle " slot ="prefix "> </ code-icon
141
+ > </ gl-button >
142
+ < gl-button appearance ="secondary " href ="command:workbench.view.scm " tooltip ="Commit via SCM "
143
+ > < code-icon rotate ="45 " icon ="arrow-up "> </ code-icon
144
+ > </ gl-button >
145
+ </ button-container >
151
146
</ div > ` ;
152
147
}
153
148
return html `< div class ="section section--actions ">
154
- < p class ="button-container ">
155
- < span class ="button-group button-group--single ">
156
- < gl-button full href ="command:workbench.view.scm "
157
- > Commit via SCM < code-icon rotate ="45 " icon ="arrow-up " slot ="suffix "> </ code-icon
158
- > </ gl-button >
159
- </ span >
160
- </ p >
149
+ < button-container >
150
+ < gl-button full href ="command:workbench.view.scm "
151
+ > Commit via SCM < code-icon rotate ="45 " icon ="arrow-up " slot ="suffix "> </ code-icon
152
+ > </ gl-button >
153
+ </ button-container >
161
154
</ div > ` ;
162
155
}
163
156
164
- private renderSecondaryAction ( ) {
157
+ private renderSecondaryAction ( hasPrimary = true ) {
165
158
if ( ! this . draftsEnabled || this . inReview ) return undefined ;
166
159
167
160
let label = 'Share as Cloud Patch' ;
@@ -185,59 +178,68 @@ export class GlWipDetails extends GlDetailsBase {
185
178
action = 'end-patch-review' ;
186
179
}
187
180
188
- return html ` < p class =" button-container " >
189
- < span class =" button-group button-group--single " >
181
+ if ( ( this . wip ?. changes ?. files . length ?? 0 ) === 0 ) {
182
+ return html `
190
183
< gl-button
184
+ ?full =${ ! hasPrimary }
191
185
appearance ="secondary"
192
- full
193
186
data-action="${ action } "
194
187
@click=${ ( ) => this . onToggleReviewMode ( ! this . inReview ) }
188
+ .tooltip=${ hasPrimary ? label : undefined }
195
189
>
196
- < code-icon icon ="gl-code-suggestion " slot ="prefix "> </ code-icon > ${ label }
197
- </ gl-button >
198
- < gl-button
199
- appearance ="secondary "
200
- density ="compact "
201
- data-action ="create-patch "
202
- tooltip ="Share as Cloud Patch "
203
- @click =${ ( ) => this . onDataActionClick ( 'create-patch' ) }
204
- >
205
- < code-icon icon ="gl-cloud-patch-share "> </ code-icon >
190
+ < code-icon icon ="gl-code-suggestion " .slot =${ ! hasPrimary ? 'prefix' : nothing } > </ code-icon
191
+ > ${ ! hasPrimary ? label : nothing }
206
192
</ gl-button >
207
- </ span >
208
- </ p > ` ;
209
- }
210
-
211
- if ( ( this . wip ?. changes ?. files . length ?? 0 ) === 0 ) return undefined ;
193
+ ` ;
194
+ }
212
195
213
- return html `< p class ="button-container ">
214
- < span class ="button-group button-group--single ">
196
+ return html `
215
197
< gl-button
198
+ ?full =${ ! hasPrimary }
216
199
appearance ="secondary"
217
- full
218
200
data-action="${ action } "
219
- @click =${ ( ) => this . onDataActionClick ( action ) }
201
+ .tooltip=${ hasPrimary ? label : undefined }
202
+ @click=${ ( ) => this . onToggleReviewMode ( ! this . inReview ) }
220
203
>
221
- < code-icon icon ="gl-cloud-patch-share " slot ="prefix "> </ code-icon > ${ label }
204
+ < code-icon icon ="gl-code-suggestion " .slot =${ ! hasPrimary ? 'prefix' : nothing } > </ code-icon
205
+ > ${ ! hasPrimary ? label : nothing }
222
206
</ gl-button >
223
- </ span >
224
- </ p > ` ;
207
+ < gl-button
208
+ appearance ="secondary "
209
+ density ="compact "
210
+ data-action ="create-patch "
211
+ tooltip ="Share as Cloud Patch "
212
+ @click =${ ( ) => this . onDataActionClick ( 'create-patch' ) }
213
+ >
214
+ < code-icon icon ="gl-cloud-patch-share "> </ code-icon >
215
+ </ gl-button >
216
+ ` ;
217
+ }
218
+
219
+ if ( ( this . wip ?. changes ?. files . length ?? 0 ) === 0 ) return undefined ;
220
+
221
+ return html `
222
+ < gl-button
223
+ ?full =${ ! hasPrimary }
224
+ appearance ="secondary"
225
+ data-action="${ action } "
226
+ .tooltip=${ hasPrimary ? label : undefined }
227
+ @click=${ ( ) => this . onDataActionClick ( action ) }
228
+ >
229
+ < code-icon icon ="gl-cloud-patch-share " .slot =${ ! hasPrimary ? 'prefix' : nothing } > </ code-icon
230
+ > ${ ! hasPrimary ? label : nothing }
231
+ </ gl-button >
232
+ ` ;
225
233
}
226
234
227
235
private renderPrimaryAction ( ) {
228
236
const canShare = this . draftsEnabled ;
229
237
if ( this . isUnpublished && canShare ) {
230
- return html `< p class ="button-container ">
231
- < span class ="button-group button-group--single ">
232
- < gl-button
233
- full
234
- data-action ="publish-branch "
235
- @click =${ ( ) => this . onDataActionClick ( 'publish-branch' ) }
236
- >
237
- < code-icon icon ="cloud-upload " slot ="prefix "> </ code-icon > Publish Branch
238
- </ gl-button >
239
- </ span >
240
- </ p > ` ;
238
+ return html `
239
+ < gl-button full data-action ="publish-branch " @click =${ ( ) => this . onDataActionClick ( 'publish-branch' ) } >
240
+ < code-icon icon ="cloud-upload " slot ="prefix "> </ code-icon > Publish Branch
241
+ </ gl-button >
242
+ ` ;
241
243
}
242
244
243
245
if ( ( ! this . isUnpublished && ! canShare ) || this . branchState == null ) return undefined ;
@@ -248,26 +250,26 @@ export class GlWipDetails extends GlDetailsBase {
248
250
const fetchLabel = behind > 0 ? 'Pull' : ahead > 0 ? 'Push' : 'Fetch' ;
249
251
const fetchIcon = behind > 0 ? 'repo-pull' : ahead > 0 ? 'repo-push' : 'repo-fetch' ;
250
252
251
- return html `< p class ="button-container ">
252
- < span class ="button-group button-group--single ">
253
- < gl-button
254
- full
255
- data-action ="${ fetchLabel . toLowerCase ( ) } "
256
- @click =${ ( ) => this . onDataActionClick ( fetchLabel . toLowerCase ( ) ) }
257
- >
258
- < code-icon icon ="${ fetchIcon } " slot ="prefix "> </ code-icon > ${ fetchLabel }
259
- < gl-tracking-pill .ahead =${ ahead } .behind =${ behind } slot="suffix"> </ gl-tracking-pill >
260
- </ gl-button >
261
- </ span >
262
- </ p > ` ;
253
+ return html `
254
+ < gl-button
255
+ full
256
+ data-action ="${ fetchLabel . toLowerCase ( ) } "
257
+ @click =${ ( ) => this . onDataActionClick ( fetchLabel . toLowerCase ( ) ) }
258
+ >
259
+ < code-icon icon ="${ fetchIcon } " slot ="prefix "> </ code-icon > ${ fetchLabel }
260
+ < gl-tracking-pill .ahead =${ ahead } .behind =${ behind } slot="suffix"> </ gl-tracking-pill >
261
+ </ gl-button >
262
+ ` ;
263
263
}
264
264
265
265
private renderActions ( ) {
266
266
const primaryAction = this . renderPrimaryAction ( ) ;
267
- const secondaryAction = this . renderSecondaryAction ( ) ;
267
+ const secondaryAction = this . renderSecondaryAction ( primaryAction != null ) ;
268
268
if ( primaryAction == null && secondaryAction == null ) return nothing ;
269
269
270
- return html `< div class ="section section--actions "> ${ primaryAction } ${ secondaryAction } </ div > ` ;
270
+ return html `< div class ="section section--actions ">
271
+ < button-container > ${ primaryAction } ${ secondaryAction } </ button-container >
272
+ </ div > ` ;
271
273
}
272
274
273
275
private renderSuggestedChanges ( ) {
0 commit comments