Skip to content

Commit 4daf098

Browse files
committed
Combines "Create PR" and "Create with AI" buttons into a split button
(#4332)
1 parent 07bdd11 commit 4daf098

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

0 commit comments

Comments
 (0)