Skip to content

Commit 0453c0b

Browse files
committed
Updates launchpad section in home
1 parent f4b6c56 commit 0453c0b

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { consume } from '@lit/context';
22
import { SignalWatcher } from '@lit-labs/signals';
33
import type { TemplateResult } from 'lit';
44
import { css, html, LitElement, nothing } from 'lit';
5-
import { customElement } from 'lit/decorators.js';
5+
import { customElement, state } from 'lit/decorators.js';
66
import type { BranchGitCommandArgs } from '../../../../../commands/git/branch';
77
import { Commands } from '../../../../../constants.commands';
88
import type { LaunchpadCommandArgs } from '../../../../../plus/launchpad/launchpad';
99
import { createCommandLink } from '../../../../../system/commands';
1010
import { pluralize } from '../../../../../system/string';
11-
import type { GetLaunchpadSummaryResponse } from '../../../../home/protocol';
11+
import type { GetLaunchpadSummaryResponse, State } from '../../../../home/protocol';
1212
import { GetLaunchpadSummary } from '../../../../home/protocol';
13+
import { stateContext } from '../../../home/context';
1314
import { AsyncComputedState } from '../../../shared/components/signal-utils';
1415
import { ipcContext } from '../../../shared/context';
1516
import type { Disposable } from '../../../shared/events';
@@ -93,6 +94,10 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
9394
`,
9495
];
9596

97+
@consume<State>({ context: stateContext, subscribe: true })
98+
@state()
99+
private _homeState!: State;
100+
96101
@consume({ context: ipcContext })
97102
private _ipc!: HostIpc;
98103
private _disposable: Disposable | undefined;
@@ -130,8 +135,12 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
130135
<span slot="heading">GitLens Launchpad</span>
131136
<div class="summary">${this.renderSummaryResult()}</div>
132137
<button-container>
133-
<gl-button full class="start-work" href=${this.startWorkCommand}
134-
><code-icon icon="git-branch" slot="prefix"></code-icon> Start work</gl-button
138+
<gl-button
139+
full
140+
class="start-work"
141+
href=${this.startWorkCommand}
142+
?disabled=${this._homeState.repositories.openCount === 0}
143+
><code-icon icon="custom-start-work" slot="prefix"></code-icon> Start Work</gl-button
135144
>
136145
</button-container>
137146
</gl-section>
@@ -142,7 +151,10 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
142151
return this._summaryState.render({
143152
pending: () => this.renderPending(),
144153
complete: summary => this.renderSummary(summary),
145-
error: () => html`<span>Error</span>`,
154+
error: () =>
155+
html`<ul class="menu">
156+
<li>Error loading summary</li>
157+
</ul>`,
146158
});
147159
}
148160

@@ -161,11 +173,15 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
161173
private renderSummary(summary: LaunchpadSummary | undefined) {
162174
if (summary == null) return nothing;
163175
if (summary.total === 0) {
164-
return html`<p>You are all caught up!</p>`;
176+
return html`<ul class="menu">
177+
<li>You are all caught up!</li>
178+
</ul>`;
165179
}
166180
if (!summary.hasGroupedItems) {
167-
return html`<p>No pull requests need your attention</p>
168-
<p>(${summary.total} other pull requests)</p>`;
181+
return html`<ul class="menu">
182+
<li>No pull requests need your attention</li>
183+
<li>(${summary.total} other pull requests)</li>
184+
</ul>`;
169185
}
170186

171187
const result: TemplateResult[] = [];

src/webviews/apps/shared/components/code-icon.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,21 @@ export class CodeIcon extends LitElement {
609609
.join(''),
610610
)}
611611
612+
:host([icon='custom-start-work']) {
613+
position: relative;
614+
}
615+
:host([icon='custom-start-work'])::before {
616+
content: '\\ea68';
617+
}
618+
:host([icon='custom-start-work'])::after {
619+
content: '\\ea60';
620+
position: absolute;
621+
right: -0.2em;
622+
bottom: -0.2em;
623+
font-size: 0.6em;
624+
line-height: normal;
625+
}
626+
612627
:host([icon='gl-pinned-filled']):before {
613628
/* TODO: see relative positioning needed in every use-case */
614629
position: relative;

0 commit comments

Comments
 (0)