Skip to content

Port remove release notes from the start page #13032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions StartPageReleaseNotes.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@
"StartPage.pythonFileDescription": "- Create a <div class=\"link\" role=\"button\" onclick={0}>new file</div> with a .py extension",
"StartPage.openInteractiveWindow": "Use the Interactive Window to develop Python Scripts",
"StartPage.interactiveWindowDesc": "- You can create cells on a Python file by typing \"#%%\" <br /> - Use \"<div class=\"italics\">Shift + Enter</div> \" to run a cell, the output will be shown in the interactive window",
"StartPage.releaseNotes": "Take a look at our <a class=\"link\" href={0}>Release Notes</a> to learn more about the latest features",
"StartPage.releaseNotes": "Take a look at our <a class=\"link\" href={0}>Release Notes</a> to learn more about the latest features.",
"StartPage.tutorialAndDoc": "Explore more features in our <a class=\"link\" href={0}>Tutorials</a> or check <a class=\"link\" href={1}>Documentation</a> for tips and troubleshooting.",
"StartPage.dontShowAgain": "Don't show this page again",
"StartPage.helloWorld": "Hello world",
Expand Down
12 changes: 2 additions & 10 deletions src/client/common/startPage/startPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ export class StartPage extends WebViewHost<IStartPageMapping> implements IStartP
case StartPageMessages.Started:
this.webviewDidLoad = true;
break;
case StartPageMessages.RequestReleaseNotesAndShowAgainSetting:
case StartPageMessages.RequestShowAgainSetting:
const settings = this.configuration.getSettings();
const filteredNotes = await this.handleReleaseNotesRequest();
await this.postMessage(StartPageMessages.SendReleaseNotes, {
notes: filteredNotes,
await this.postMessage(StartPageMessages.SendSetting, {
showAgainSetting: settings.showStartPage
});
break;
Expand Down Expand Up @@ -245,12 +243,6 @@ export class StartPage extends WebViewHost<IStartPageMapping> implements IStartP
return shouldShowStartPage;
}

// This gets the release notes from StartPageReleaseNotes.md
private async handleReleaseNotesRequest(): Promise<string[]> {
const releaseNotes = await this.file.readFile(path.join(EXTENSION_ROOT_DIR, 'StartPageReleaseNotes.md'));
return releaseNotes.splitLines();
}

private async activateBackground(): Promise<void> {
const enabled = await this.expService.inExperiment(EnableStartPage.experiment);
const settings = this.configuration.getSettings();
Expand Down
11 changes: 5 additions & 6 deletions src/client/common/startPage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ export interface IStartPage {
extensionVersionChanged(): Promise<boolean>;
}

export interface IReleaseNotesPackage {
notes: string[];
export interface ISettingPackage {
showAgainSetting: boolean;
}

export namespace StartPageMessages {
export const Started = SharedMessages.Started;
export const UpdateSettings = SharedMessages.UpdateSettings;
export const RequestReleaseNotesAndShowAgainSetting = 'RequestReleaseNotesAndShowAgainSetting';
export const SendReleaseNotes = 'SendReleaseNotes';
export const RequestShowAgainSetting = 'RequestShowAgainSetting';
export const SendSetting = 'SendSetting';
export const OpenBlankNotebook = 'OpenBlankNotebook';
export const OpenBlankPythonFile = 'OpenBlankPythonFile';
export const OpenInteractiveWindow = 'OpenInteractiveWindow';
Expand All @@ -30,8 +29,8 @@ export namespace StartPageMessages {
}

export class IStartPageMapping {
public [StartPageMessages.RequestReleaseNotesAndShowAgainSetting]: IReleaseNotesPackage;
public [StartPageMessages.SendReleaseNotes]: IReleaseNotesPackage;
public [StartPageMessages.RequestShowAgainSetting]: ISettingPackage;
public [StartPageMessages.SendSetting]: ISettingPackage;
public [StartPageMessages.Started]: never | undefined;
public [StartPageMessages.UpdateSettings]: boolean;
public [StartPageMessages.OpenBlankNotebook]: never | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ export namespace StartPage {

export const releaseNotes = localize(
'StartPage.releaseNotes',
'Take a look at our <a class="link" href={0}>Release Notes</a> to learn more about the latest features'
'Take a look at our <a class="link" href={0}>Release Notes</a> to learn more about the latest features.'
);
export const tutorialAndDoc = localize(
'StartPage.tutorialAndDoc',
Expand Down
6 changes: 6 additions & 0 deletions src/datascience-ui/startPage/startPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
white-space: nowrap;
}

.releaseNotesRow {
display: block;
min-height: 50px;
white-space: nowrap;
}

.link {
display: inline;
color: var(--vscode-debugIcon-continueForeground);
Expand Down
23 changes: 6 additions & 17 deletions src/datascience-ui/startPage/startPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as React from 'react';
import '../../client/common/extensions';
import { IReleaseNotesPackage, IStartPageMapping, StartPageMessages } from '../../client/common/startPage/types';
import { ISettingPackage, IStartPageMapping, StartPageMessages } from '../../client/common/startPage/types';
import { Image, ImageName } from '../react-common/image';
import { getLocString } from '../react-common/locReactSide';
import { IMessageHandler, PostOffice } from '../react-common/postOffice';
Expand All @@ -19,8 +19,7 @@ export interface IStartPageProps {
// Front end of the Python extension start page.
// In general it consists of its render method and methods that send and receive messages.
export class StartPage extends React.Component<IStartPageProps> implements IMessageHandler {
private releaseNotes: IReleaseNotesPackage = {
notes: [],
private releaseNotes: ISettingPackage = {
showAgainSetting: false
};
private postOffice: PostOffice = new PostOffice();
Expand All @@ -30,7 +29,7 @@ export class StartPage extends React.Component<IStartPageProps> implements IMess
}

public componentDidMount() {
this.postOffice.sendMessage<IStartPageMapping>(StartPageMessages.RequestReleaseNotesAndShowAgainSetting);
this.postOffice.sendMessage<IStartPageMapping>(StartPageMessages.RequestShowAgainSetting);
}

// tslint:disable: no-any
Expand Down Expand Up @@ -129,9 +128,8 @@ export class StartPage extends React.Component<IStartPageProps> implements IMess
{this.renderInteractiveWindowDescription()}
</div>
</div>
<div className="row">
<div className="releaseNotesRow">
{this.renderReleaseNotesLink()}
{this.renderReleaseNotes()}
{this.renderTutorialAndDoc()}
</div>
<div className="block">
Expand All @@ -151,8 +149,7 @@ export class StartPage extends React.Component<IStartPageProps> implements IMess

// tslint:disable-next-line: no-any
public handleMessage = (msg: string, payload?: any) => {
if (msg === StartPageMessages.SendReleaseNotes) {
this.releaseNotes.notes = payload.notes;
if (msg === StartPageMessages.SendSetting) {
this.releaseNotes.showAgainSetting = payload.showAgainSetting;
this.setState({});
}
Expand Down Expand Up @@ -240,21 +237,13 @@ export class StartPage extends React.Component<IStartPageProps> implements IMess
dangerouslySetInnerHTML={{
__html: getLocString(
'StartPage.releaseNotes',
'Take a look at our <a class="link" href={0}>Release Notes</a> to learn more about the latest features'
'Take a look at our <a class="link" href={0}>Release Notes</a> to learn more about the latest features.'
).format('https://aka.ms/AA8dxtb')
}}
/>
);
}

private renderReleaseNotes(): JSX.Element {
const notes: JSX.Element[] = [];
this.releaseNotes.notes.forEach((rel, index) => {
notes.push(<li key={index}>{rel}</li>);
});
return <ul className="list">{notes}</ul>;
}

private renderTutorialAndDoc(): JSX.Element {
// tslint:disable: react-no-dangerous-html
return (
Expand Down