Skip to content

Commit c3073d5

Browse files
committed
Combines "Create PR" and "Create with AI" buttons into a split button
(#4332, #4347)
1 parent 0bdde89 commit c3073d5

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

src/webviews/apps/plus/home/components/branch-card.ts

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -790,39 +790,44 @@ export abstract class GlBranchCardBase extends GlElement {
790790
if (!this.pr) {
791791
if (this.branch.upstream?.missing === false && this.expanded) {
792792
return html`
793-
<div class="branch-item__row">
794-
<gl-button
795-
class="branch-item__missing"
796-
appearance="secondary"
797-
full
798-
href="${createCommandLink('gitlens.home.createPullRequest', {
799-
ref: this.branchRef,
800-
describeWithAI: false,
801-
source: { source: 'home', detail: 'create-pr' },
802-
})}"
803-
>Create a Pull Request</gl-button
804-
>
805-
${this._homeState.orgSettings.ai &&
806-
this._homeState.aiEnabled &&
807-
this.remote?.provider?.supportedFeatures?.createPullRequestWithDetails
808-
? html`<gl-button
809-
class="branch-item__missing"
810-
tooltip="Create a Pull Request with AI (Preview)"
811-
appearance="secondary"
812-
href="${createCommandLink<CreatePullRequestCommandArgs>(
813-
'gitlens.home.createPullRequest',
814-
{
815-
ref: this.branchRef,
816-
describeWithAI: true,
817-
source: { source: 'home', detail: 'create-pr' },
818-
},
819-
)}"
820-
>
821-
<code-icon class="branch-item__is-wide" icon="sparkle" slot="prefix"></code-icon>
822-
<code-icon class="branch-item__is-narrow" icon="sparkle"></code-icon>
823-
<span class="branch-item__is-wide">Create with AI</span>
824-
</gl-button>`
825-
: nothing}
793+
<div>
794+
<button-container grouping="split" layout="full">
795+
<gl-button
796+
class="branch-item__missing"
797+
appearance="secondary"
798+
full
799+
href="${createCommandLink('gitlens.home.createPullRequest', {
800+
ref: this.branchRef,
801+
describeWithAI: false,
802+
source: { source: 'home', detail: 'create-pr' },
803+
})}"
804+
>Create a Pull Request</gl-button
805+
>
806+
${this._homeState.orgSettings.ai &&
807+
this._homeState.aiEnabled &&
808+
this.remote?.provider?.supportedFeatures?.createPullRequestWithDetails
809+
? html`<gl-button
810+
class="branch-item__missing"
811+
tooltip="Create a Pull Request with AI (Preview)"
812+
appearance="secondary"
813+
href="${createCommandLink<CreatePullRequestCommandArgs>(
814+
'gitlens.home.createPullRequest',
815+
{
816+
ref: this.branchRef,
817+
describeWithAI: true,
818+
source: { source: 'home', detail: 'create-pr' },
819+
},
820+
)}"
821+
>
822+
<code-icon
823+
class="branch-item__is-wide"
824+
icon="sparkle"
825+
slot="prefix"
826+
></code-icon>
827+
<code-icon class="branch-item__is-narrow" icon="sparkle"></code-icon>
828+
</gl-button>`
829+
: nothing}
830+
</button-container>
826831
</div>
827832
`;
828833
}

0 commit comments

Comments
 (0)