Browse Source

Merge pull request #523 from MortalKastor/release-notes

Show version and release notes on about page
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
73924d41d3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      src/components/SettingsPage/sections/About.js
  2. 4
      src/components/modals/ReleaseNotes.js
  3. 2
      src/reducers/settings.js

29
src/components/SettingsPage/sections/About.js

@ -2,11 +2,16 @@
import React, { PureComponent } from 'react'
import { shell } from 'electron'
import { connect } from 'react-redux'
import type { T } from 'types/common'
import IconHelp from 'icons/Help'
import IconExternalLink from 'icons/ExternalLink'
import Button from 'components/base/Button'
import { openModal } from 'reducers/modals'
import { MODAL_RELEASES_NOTES } from 'config/constants'
import {
SettingsSection as Section,
@ -17,13 +22,20 @@ import {
type Props = {
t: T,
openModal: Function,
}
const mapDispatchToProps = {
openModal,
}
class SectionAbout extends PureComponent<Props> {
handleOpenLink = (url: string) => () => shell.openExternal(url)
render() {
const { t } = this.props
const { t, openModal } = this.props
const version = __APP_VERSION__
return (
<Section>
<Header
@ -32,6 +44,16 @@ class SectionAbout extends PureComponent<Props> {
desc="Lorem ipsum dolor sit amet"
/>
<Body>
<Row title="Version" desc={version}>
<Button
primary
onClick={() => {
openModal(MODAL_RELEASES_NOTES, version)
}}
>
Show release notes
</Button>
</Row>
<Row
onClick={this.handleOpenLink('https://support.ledgerwallet.com/hc/en-us')}
title={t('app:settings.about.faq')}
@ -59,4 +81,7 @@ class SectionAbout extends PureComponent<Props> {
}
}
export default SectionAbout
export default connect(
null,
mapDispatchToProps,
)(SectionAbout)

4
src/components/modals/ReleaseNotes.js

@ -156,6 +156,10 @@ class ReleaseNotes extends PureComponent<Props, State> {
fetchNotes = version => {
if (!this.state.loading) {
this.setState({
loading: true,
})
axios
.get(`https://api.github.com/repos/LedgerHQ/ledger-live-desktop/releases/tags/v${version}`)
.then(response => {

2
src/reducers/settings.js

@ -74,7 +74,7 @@ const INITIAL_STATE: SettingsState = {
loaded: false,
shareAnalytics: false,
sentryLogs: false,
lastUsedVersion: '0.1.0-alpha.7', // Temp hack to show release notes on update to alpha 8, should ne replaced by __APP_VERSION__
lastUsedVersion: __APP_VERSION__,
}
function asCryptoCurrency(c: Currency): ?CryptoCurrency {

Loading…
Cancel
Save