Skip to content

Commit 95a9523

Browse files
Splits Start Work button into two
One for starting work on issue, one for creating branch Closes #3808
1 parent cf00fc4 commit 95a9523

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

src/commands/quickWizard.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class QuickWizardRootStep implements QuickPickStep<QuickCommand> {
115115
}
116116

117117
if (args?.command === 'startWork') {
118-
this.hiddenItems.push(new StartWorkCommand(container));
118+
this.hiddenItems.push(new StartWorkCommand(container, args));
119119
}
120120
}
121121

src/plus/startWork/startWork.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type StartWorkTypeItem = { type: StartWorkType };
6565
export interface StartWorkCommandArgs {
6666
readonly command: 'startWork';
6767
source?: Sources;
68+
type?: StartWorkType;
6869
}
6970

7071
export const supportedStartWorkIntegrations = [HostingIntegrationId.GitHub, IssueIntegrationId.Jira];
@@ -87,7 +88,8 @@ export class StartWorkCommand extends QuickCommand<State> {
8788
}
8889

8990
this.initialState = {
90-
counter: 0,
91+
counter: args?.type != null ? 1 : 0,
92+
type: args?.type,
9193
};
9294
}
9395

@@ -108,7 +110,7 @@ export class StartWorkCommand extends QuickCommand<State> {
108110
const hasConnectedIntegrations = this.hasConnectedIntegrations(context);
109111
context.title = this.title;
110112

111-
if (state.counter < 1) {
113+
if (state.counter < 1 || state.type == null) {
112114
if (this.container.telemetry.enabled) {
113115
this.container.telemetry.sendEvent(
114116
opened ? 'startWork/steps/type' : 'startWork/opened',
@@ -124,6 +126,7 @@ export class StartWorkCommand extends QuickCommand<State> {
124126
const result = yield* this.selectTypeStep(state);
125127
if (result === StepResultBreak) continue;
126128
state.type = result.type;
129+
127130
if (this.container.telemetry.enabled) {
128131
this.container.telemetry.sendEvent(
129132
'startWork/type/chosen',

src/webviews/apps/plus/home/components/launchpad.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,30 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
112112
});
113113

114114
get startWorkCommand() {
115-
return createCommandLink<StartWorkCommandArgs>(Commands.StartWork, { command: 'startWork', source: 'home' });
115+
return createCommandLink<StartWorkCommandArgs>(Commands.StartWork, {
116+
command: 'startWork',
117+
source: 'home',
118+
type: 'issue',
119+
});
120+
}
121+
122+
get createBranchCommand() {
123+
return createCommandLink<StartWorkCommandArgs>(Commands.StartWork, {
124+
command: 'startWork',
125+
source: 'home',
126+
type: 'branch',
127+
});
128+
// TODO: Switch to using the base git command once we support sending source telemetry to that command, and then clean up start work
129+
// command to just be for issues and remove "type" param
130+
/*return createCommandLink<BranchGitCommandArgs>(Commands.GitCommands, {
131+
command: 'branch',
132+
state: {
133+
subcommand: 'create',
134+
suggestNameOnly: true,
135+
suggestRepoOnly: true,
136+
confirmOptions: ['--switch', '--worktree'],
137+
},
138+
});*/
116139
}
117140

118141
override connectedCallback() {
@@ -133,9 +156,14 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
133156
<span slot="heading">GitLens Launchpad</span>
134157
<div class="summary">${this.renderSummaryResult()}</div>
135158
<button-container>
136-
<gl-button full class="start-work" href=${this.startWorkCommand}
137-
><code-icon icon="custom-start-work" slot="prefix"></code-icon> Start Work</gl-button
138-
>
159+
<gl-button full class="start-work" href=${this.startWorkCommand}>Start Work on an Issue</gl-button>
160+
<gl-button
161+
appearance="secondary"
162+
density="compact"
163+
class="start-work"
164+
href=${this.createBranchCommand}
165+
><code-icon icon="custom-start-work"></code-icon
166+
></gl-button>
139167
</button-container>
140168
</gl-section>
141169
`;

0 commit comments

Comments
 (0)