From c5881e258a69819e48abb4c1aabc8366320d9ffe Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Wed, 23 Nov 2016 11:59:26 -0800 Subject: [PATCH] Simplify changelog --- app/main.development.js | 11 ++++++++++ .../components/dropdowns/WorkspaceDropdown.js | 4 ++-- app/ui/components/modals/ChangelogModal.js | 20 +++++++------------ app/ui/containers/App.js | 4 ++++ app/ui/css/components/changelog.less | 4 ++++ 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/main.development.js b/app/main.development.js index 8a0d0c510..f21ead518 100644 --- a/app/main.development.js +++ b/app/main.development.js @@ -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 diff --git a/app/ui/components/dropdowns/WorkspaceDropdown.js b/app/ui/components/dropdowns/WorkspaceDropdown.js index 38cc762e7..6a06b71c1 100644 --- a/app/ui/components/dropdowns/WorkspaceDropdown.js +++ b/app/ui/components/dropdowns/WorkspaceDropdown.js @@ -120,8 +120,8 @@ class WorkspaceDropdown extends Component { Settings - showModal(ChangelogModal)}> - Changelog + showModal(SettingsModal, TAB_INDEX_EXPORT)}> + For Team ) diff --git a/app/ui/components/modals/ChangelogModal.js b/app/ui/components/modals/ChangelogModal.js index 5f7df09e0..dd543b23e 100644 --- a/app/ui/components/modals/ChangelogModal.js +++ b/app/ui/components/modals/ChangelogModal.js @@ -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; diff --git a/app/ui/containers/App.js b/app/ui/containers/App.js index 0ac1a3737..3cafaeb05 100644 --- a/app/ui/containers/App.js +++ b/app/ui/containers/App.js @@ -302,6 +302,10 @@ class App extends Component { toggleModal(SettingsModal); }); + ipcRenderer.on('toggle-changelog', () => { + toggleModal(ChangelogModal); + }); + ipcRenderer.on('toggle-sidebar', this._handleToggleSidebar.bind(this)); } diff --git a/app/ui/css/components/changelog.less b/app/ui/css/components/changelog.less index 042034fe6..9530f9303 100644 --- a/app/ui/css/components/changelog.less +++ b/app/ui/css/components/changelog.less @@ -16,4 +16,8 @@ padding-left: @padding-lg; margin-bottom: 1.5em; } + + hr { + margin: @padding-lg 0 !important; + } }