aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/ProxyApp.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/components/ProxyApp.jsx')
-rw-r--r--web/src/js/components/ProxyApp.jsx43
1 files changed, 12 insertions, 31 deletions
diff --git a/web/src/js/components/ProxyApp.jsx b/web/src/js/components/ProxyApp.jsx
index c458639d..8129b0f0 100644
--- a/web/src/js/components/ProxyApp.jsx
+++ b/web/src/js/components/ProxyApp.jsx
@@ -3,10 +3,10 @@ import ReactDOM from 'react-dom'
import _ from 'lodash'
import { connect } from 'react-redux'
+import { fetch as fetchSettings } from '../ducks/settings'
import Header from './Header'
import EventLog from './EventLog'
import Footer from './Footer'
-import { SettingsStore } from '../store/store.js'
import { Key } from '../utils.js'
class ProxyAppMain extends Component {
@@ -22,17 +22,9 @@ class ProxyAppMain extends Component {
constructor(props, context) {
super(props, context)
- this.settingsStore = new SettingsStore()
-
- // Default Settings before fetch
- _.extend(this.settingsStore.dict, {})
-
- this.state = { settings: this.settingsStore.dict }
-
this.focus = this.focus.bind(this)
this.onKeyDown = this.onKeyDown.bind(this)
this.updateLocation = this.updateLocation.bind(this)
- this.onSettingsChange = this.onSettingsChange.bind(this)
}
/**
@@ -58,30 +50,16 @@ class ProxyAppMain extends Component {
return _.clone(this.props.location.query)
}
+ componentWillMount() {
+ this.props.fetchSettings();
+ }
+
/**
- * @todo remove settings store
* @todo connect websocket here
* @todo listen to window's key events
*/
componentDidMount() {
this.focus()
- this.settingsStore.addListener('recalculate', this.onSettingsChange)
- }
-
- /**
- * @todo remove settings store
- * @todo disconnect websocket here
- * @todo stop listening to window's key events
- */
- componentWillUnmount() {
- this.settingsStore.removeListener('recalculate', this.onSettingsChange)
- }
-
- /**
- * @todo move to actions
- */
- onSettingsChange() {
- this.setState({ settings: this.settingsStore.dict })
}
/**
@@ -139,8 +117,7 @@ class ProxyAppMain extends Component {
}
render() {
- const { showEventLog, location, children } = this.props
- const { settings } = this.state
+ const { showEventLog, location, children, settings } = this.props
const query = this.getQuery()
return (
<div id="container" tabIndex="0" onKeyDown={this.onKeyDown}>
@@ -160,6 +137,10 @@ class ProxyAppMain extends Component {
export default connect(
state => ({
- showEventLog: state.eventLog.visible
- })
+ showEventLog: state.eventLog.visible,
+ settings: state.settings.settings,
+ }),
+ {
+ fetchSettings,
+ }
)(ProxyAppMain)