-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add popup to display the change log at first launch (#201)
- Loading branch information
Showing
13 changed files
with
335 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{#each releases}} | ||
{{#if href}} | ||
###{{#unless major}}#{{/unless}} {{title}} {{#if tag}}: {{niceDate}}{{/if}} | ||
{{else}} | ||
#### {{title}} | ||
{{/if}} | ||
|
||
{{#if summary}} | ||
{{summary}} | ||
{{/if}} | ||
|
||
{{#each merges}} | ||
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}}{{#if href}} ({{author}}) `#{{id}}`{{/if}} | ||
{{/each}} | ||
{{#each fixes}} | ||
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}}{{#if href}} ({{author}}) `#{{id}}`{{/if}}{{/each}} | ||
{{/each}} | ||
{{#each commits}} | ||
- {{#if breaking}}**Breaking change:** {{/if}}{{subject}}{{#if href}} ({{author}}) `{{shorthash}}`{{/if}} | ||
{{/each}} | ||
|
||
{{/each}} | ||
|
||
{{#unless options.hideCredit}} | ||
Change Log generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
{{/unless}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{#each releases}} | ||
{{#if href}} | ||
###{{#unless major}}#{{/unless}} [{{title}}]({{href}}) {{#if tag}}: {{niceDate}}{{/if}} | ||
{{else}} | ||
#### {{title}} | ||
{{/if}} | ||
|
||
{{#if summary}} | ||
{{summary}} | ||
{{/if}} | ||
|
||
{{#each merges}} | ||
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}}{{#if href}} ({{author}}) [`#{{id}}`]({{href}}){{/if}} | ||
{{/each}} | ||
{{#each fixes}} | ||
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}}{{#if href}} ({{author}}) [`#{{id}}`]({{href}}){{/if}}{{/each}} | ||
{{/each}} | ||
{{#each commits}} | ||
- {{#if breaking}}**Breaking change:** {{/if}}{{subject}}{{#if href}} ({{author}}) [`{{shorthash}}`]({{href}}){{/if}} | ||
{{/each}} | ||
|
||
{{/each}} | ||
|
||
{{#unless options.hideCredit}} | ||
Change Log generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
{{/unless}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import {Modal, Button} from 'react-bootstrap'; | ||
|
||
export default class ChangelogComponent extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
htmlContent: '', | ||
show: true | ||
}; | ||
this.handleClose = this.handleClose.bind(this); | ||
this.popupTitle = "What's new "; | ||
if (this.props.lastUsedVersion === '') { | ||
this.popupTitle += 'in Instrument Panel' | ||
} else { | ||
this.popupTitle += 'since version ' + this.props.lastUsedVersion; | ||
} | ||
} | ||
|
||
handleClose() { | ||
this.setState( | ||
{ show: false } | ||
); | ||
this.props.model.lens("changelogVisible").set(false) | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="help"> | ||
<Modal show={this.state.show} backdrop="static" onHide={this.handleClose}> | ||
<Modal.Header closeButton> | ||
<Modal.Title>{this.popupTitle}</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
<div>You can find this changelog later in the help</div> | ||
<div className="" dangerouslySetInnerHTML={ {__html: this.state.htmlContent} } /> | ||
</Modal.Body> | ||
<Modal.Footer> | ||
<Button onClick={this.handleClose}>Close</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
</div> | ||
); | ||
} | ||
|
||
componentDidMount() { | ||
let that = this; | ||
let errorMessage = 'Error when loading the changelog content. <BR/>Please close popup...' | ||
fetch('./CHANGELOG.html') | ||
.then(response => { | ||
if (response.status === 200) { | ||
return response.text(); | ||
} else { | ||
return '[' + response.status + '] ' + errorMessage; | ||
} | ||
}).catch(err => { | ||
return '[' + err + '] ' + errorMessage; | ||
}).then( content => { | ||
that.setState({htmlContent: content}) | ||
}); | ||
this.setState({htmlContent: 'Loading the changelog content...'}) | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.