WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 2dd8309

Browse files
committed
Removes welcome webview and integrates into home
Consolidates the welcome webview functionality into the home webview. This change removes the dedicated welcome webview and integrates its components directly into the home webview as an overlay. This simplifies the webview structure and reduces redundancy. It also moves the feature cards to shared welcome parts for better reusability. (#4769, #4773, PLG-138)
1 parent 13348bd commit 2dd8309

19 files changed

+329
-497
lines changed

src/container.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ import { RebaseEditorProvider } from './webviews/rebase/rebaseEditor';
7979
import { registerSettingsWebviewCommands, registerSettingsWebviewPanel } from './webviews/settings/registration';
8080
import { WebviewCommandRegistrar } from './webviews/webviewCommandRegistrar';
8181
import { WebviewsController } from './webviews/webviewsController';
82-
import { registerWelcomeWebviewPanel } from './webviews/welcome/registration';
8382

8483
export type Environment = 'dev' | 'staging' | 'production';
8584

@@ -262,9 +261,6 @@ export class Container {
262261
this._disposables.push(settingsPanels);
263262
this._disposables.push(registerSettingsWebviewCommands(settingsPanels));
264263

265-
const welcomePanels = registerWelcomeWebviewPanel(webviews);
266-
this._disposables.push(welcomePanels);
267-
268264
this._disposables.push(new ViewFileDecorationProvider());
269265

270266
const patchDetailsPanels = registerPatchDetailsWebviewPanel(webviews);

src/webviews/apps/home/components/welcome-overlay.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { consume } from '@lit/context';
22
import { css, html, LitElement, nothing } from 'lit';
3-
import { customElement, state } from 'lit/decorators.js';
3+
import { customElement, property, state } from 'lit/decorators.js';
44
import type { State } from '../../../home/protocol';
55
import { CollapseSectionCommand } from '../../../home/protocol';
66
import { ipcContext } from '../../shared/contexts/ipc';
77
import type { HostIpc } from '../../shared/ipc';
88
import { stateContext } from '../context';
9-
import '../../welcome/welcome';
9+
import './welcome-page';
1010

1111
declare global {
1212
interface HTMLElementTagNameMap {
@@ -37,12 +37,18 @@ export class GlWelcomeOverlay extends LitElement {
3737
background-color: var(--background-color);
3838
}
3939
40-
gl-welcome-app {
40+
gl-welcome-page {
4141
--page-background-color: var(--background-color);
4242
}
4343
`,
4444
];
4545

46+
@property({ type: String })
47+
webroot?: string;
48+
49+
@property({ type: Boolean })
50+
private isLightTheme = false;
51+
4652
@consume<State>({ context: stateContext, subscribe: true })
4753
@state()
4854
private _state!: State;
@@ -62,11 +68,9 @@ export class GlWelcomeOverlay extends LitElement {
6268

6369
return html`
6470
<div class="overlay">
65-
<gl-welcome-app
66-
name="WelcomeView"
67-
placement="#{placement}"
68-
bootstrap="#{state}"
69-
webroot="#{webroot}"
71+
<gl-welcome-page
72+
.webroot=${this.webroot}
73+
.isLightTheme=${this.isLightTheme}
7074
closeable
7175
@close=${() => this.onClose()}
7276
></gl-welcome-app>

src/webviews/apps/welcome/welcome.css.ts renamed to src/webviews/apps/home/components/welcome-page.css.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ const main = css`
6868
max-width: 100%;
6969
}
7070
71+
.welcome {
72+
max-height: 100%;
73+
overflow: auto;
74+
position: relative;
75+
}
76+
7177
.close-button {
7278
position: absolute;
73-
right: 1em;
74-
top: 1em;
79+
right: 2px;
80+
top: 2px;
7581
z-index: 1;
7682
}
7783
`;

src/webviews/apps/welcome/welcome.ts renamed to src/webviews/apps/home/components/welcome-page.ts

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
1-
/*global*/
2-
import './welcome.scss';
3-
import { html } from 'lit';
4-
import { customElement, property, state } from 'lit/decorators.js';
5-
import type { GlCommands } from '../../../constants.commands';
6-
import { ExecuteCommand } from '../../protocol';
7-
import type { State } from '../../welcome/protocol';
8-
import { GlAppHost } from '../shared/appHost';
9-
import { scrollableBase } from '../shared/components/styles/lit/base.css';
10-
import type { LoggerContext } from '../shared/contexts/logger';
11-
import type { HostIpc } from '../shared/ipc';
12-
import type { ThemeChangeEvent } from '../shared/theme';
13-
import { WelcomeStateProvider } from './stateProvider';
14-
import '../shared/components/gitlens-logo';
15-
import '../shared/components/button';
16-
import '../shared/components/code-icon';
17-
import { welcomeStyles } from './welcome.css';
18-
import './components/feature-carousel';
19-
import './components/feature-card';
20-
import './components/feature-narrow-card';
21-
import './components/scrollable-features';
1+
import { consume } from '@lit/context';
2+
import { html, LitElement } from 'lit';
3+
import { customElement, property } from 'lit/decorators.js';
4+
import type { GlCommands } from '../../../../constants.commands';
5+
import { ExecuteCommand } from '../../../protocol';
6+
import { scrollableBase } from '../../shared/components/styles/lit/base.css';
7+
import { ipcContext } from '../../shared/contexts/ipc';
8+
import type { TelemetryContext } from '../../shared/contexts/telemetry';
9+
import { telemetryContext } from '../../shared/contexts/telemetry';
10+
import { welcomeStyles } from './welcome-page.css';
11+
import '../../shared/components/gitlens-logo';
12+
import '../../shared/components/button';
13+
import '../../shared/components/code-icon';
14+
import './welcome-parts';
15+
16+
declare global {
17+
interface HTMLElementTagNameMap {
18+
'gl-welcome-page': GlWelcomePage;
19+
}
20+
}
2221

2322
const helpBlameUrl =
2423
'https://www.gitkraken.com/gitlens?utm_source=gitlens-extension&utm_medium=in-app-links#Visual-Repository-Intelligence';
2524
const helpLaunchpadUrl =
2625
'https://www.gitkraken.com/gitlens?utm_source=gitlens-extension&utm_medium=in-app-links#Visual-Repository-Intelligence';
2726

28-
@customElement('gl-welcome-app')
29-
export class GlWelcomeApp extends GlAppHost<State> {
27+
@customElement('gl-welcome-page')
28+
export class GlWelcomePage extends LitElement {
3029
static override styles = [scrollableBase, welcomeStyles];
30+
//static override styles = welcomeStyles;
3131

32-
protected override createStateProvider(
33-
bootstrap: string,
34-
ipc: HostIpc,
35-
logger: LoggerContext,
36-
): WelcomeStateProvider {
37-
return new WelcomeStateProvider(this, bootstrap, ipc, logger);
38-
}
32+
@property({ type: Boolean })
33+
closeable = false;
3934

4035
@property({ type: String })
4136
webroot?: string;
4237

4338
@property({ type: Boolean })
44-
closeable = false;
45-
46-
@state()
4739
private isLightTheme = false;
4840

49-
protected override onThemeUpdated(e: ThemeChangeEvent): void {
50-
this.isLightTheme = e.isLightTheme;
51-
}
41+
@consume({ context: ipcContext })
42+
_ipc!: typeof ipcContext.__context__;
43+
44+
@consume({ context: telemetryContext as { __context__: TelemetryContext } })
45+
_telemetry!: TelemetryContext;
5246

5347
private onStartTrial() {
5448
const command: GlCommands = 'gitlens.plus.signUp';

0 commit comments

Comments
 (0)