1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Add checkbox for ama

This commit is contained in:
asmsuechan
2017-07-22 08:59:27 +09:00
parent d0b835a825
commit 275e3317a3
4 changed files with 40 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoTab.styl'
import ConfigManager from 'browser/main/lib/ConfigManager'
import store from 'browser/main/store'
const electron = require('electron')
const { shell, remote } = electron
@@ -11,6 +13,7 @@ class InfoTab extends React.Component {
super(props)
this.state = {
config: this.props.config
}
}
@@ -19,6 +22,25 @@ class InfoTab extends React.Component {
e.preventDefault()
}
handleConfigChange (e) {
const newConfig = { amaEnabled: this.refs.amaEnabled.checked }
this.setState({ config: newConfig })
}
handleSaveButtonClick (e) {
let newConfig = {
amaEnabled: this.state.config.amaEnabled
}
ConfigManager.set(newConfig)
store.dispatch({
type: 'SET_CONFIG',
config: newConfig
})
}
render () {
return (
<div styleName='root'>
@@ -68,6 +90,13 @@ class InfoTab extends React.Component {
License: GPL v3
</li>
</ul>
<input onChange={(e) => this.handleConfigChange(e)}
checked={this.state.config.amaEnabled}
ref='amaEnabled'
type='checkbox'
/>
Enable to send analytics to our servers
<button onClick={(e) => this.handleSaveButtonClick(e)}>Save</button>
</div>
)
}