Simplify changelog

This commit is contained in:
Gregory Schier 2016-11-23 11:59:26 -08:00
parent 82f1c23a02
commit c5881e258a
5 changed files with 28 additions and 15 deletions

View File

@ -341,6 +341,17 @@ function createWindow () {
trackEvent('App Menu', 'Preferences');
}
},
{
label: "Changelog",
click: function (menuItem, window, e) {
if (!window || !window.webContents) {
return
}
window.webContents.send('toggle-changelog');
trackEvent('App Menu', 'Changelog');
}
},
{
type: "separator",
visible: IS_MAC

View File

@ -120,8 +120,8 @@ class WorkspaceDropdown extends Component {
<i className="fa fa-cog"></i> Settings
<DropdownHint char=","></DropdownHint>
</DropdownItem>
<DropdownItem onClick={e => showModal(ChangelogModal)}>
<i className="fa fa-blank"></i> Changelog
<DropdownItem onClick={e => showModal(SettingsModal, TAB_INDEX_EXPORT)}>
<i className="fa fa-users"></i> For Team
</DropdownItem>
</Dropdown>
)

View File

@ -9,18 +9,15 @@ import {getAppVersion, CHANGELOG_URL, CHANGELOG_PAGE} from '../../../common/cons
class ChangelogModal extends Component {
constructor (props) {
super(props);
this.state = {
startVersion: getAppVersion(),
changelog: null
};
this.state = {changelog: null};
}
show (startVersion = null) {
show () {
this.modal.show();
}
if (startVersion) {
this.setState({startVersion});
}
toggle () {
this.modal.toggle();
}
async componentDidMount () {
@ -36,12 +33,8 @@ class ChangelogModal extends Component {
this.setState({changelog});
}
shouldComponentUpdate (nextProps, nextState) {
return nextState !== this.state;
}
render () {
const {changelog, startVersion} = this.state;
const {changelog} = this.state;
let html;
@ -54,6 +47,7 @@ class ChangelogModal extends Component {
} else {
html = [];
const startVersion = getAppVersion();
let startIndex = changelog.findIndex(c => c.version === startVersion);
if (startIndex < 0) {
startIndex = 0;

View File

@ -302,6 +302,10 @@ class App extends Component {
toggleModal(SettingsModal);
});
ipcRenderer.on('toggle-changelog', () => {
toggleModal(ChangelogModal);
});
ipcRenderer.on('toggle-sidebar', this._handleToggleSidebar.bind(this));
}

View File

@ -16,4 +16,8 @@
padding-left: @padding-lg;
margin-bottom: 1.5em;
}
hr {
margin: @padding-lg 0 !important;
}
}