diff --git a/DevTools.js b/DevTools.js
index 81ada61ed..e28d60287 100644
--- a/DevTools.js
+++ b/DevTools.js
@@ -15,7 +15,7 @@ const DevTools = createDevTools(
// Note: DockMonitor is visible by default.
diff --git a/containers/Explorer.js b/containers/Explorer.js
index 46ed7e057..0447083d5 100644
--- a/containers/Explorer.js
+++ b/containers/Explorer.js
@@ -1,26 +1,29 @@
import React from 'react'
import {selectVariables, selectTagStats} from '../selectors'
import {connect} from 'react-redux'
+import {bindActionCreators} from 'redux'
+import * as actions from '../actions'
const Variable = ({data: {variable, tags}}) =>
{variable}
- {Object.keys(tags).map(name => -
+
{Object.keys(tags).map(name => -
{name + ': ' + tags[name]}
)}
class Explorer extends React.Component {
render() {
+ let {tags, actions, variables} = this.props
return (
Les prélèvements sociaux sur les salaires
- {this.props.variables.map((v, i) => )}
+ {variables.map((v, i) => )}
)
@@ -29,25 +32,31 @@ class Explorer extends React.Component {
class TagSelect extends React.Component {
render(){
- let {name, choices, number} = this.props.tag
+ let {tag: {name, choices, number}, selectTag} = this.props
return (-
{`${name} (${number} variables)`}
- {[...choices].map(c => -
+ {[...choices].map(c =>
+
- selectTag(name, c)}>
{c}
-
)}
+
+ )}
)
}
}
-const mapStateToProps = (state) => (
+const mapStateToProps = state => (
{
variables: selectVariables(state),
tags: selectTagStats(state)
}
)
-const VariableExplorer = connect(mapStateToProps)(Explorer)
+const actionsToProps = dispatch => ({
+ actions: bindActionCreators(actions, dispatch),
+})
+
+const VariableExplorer = connect(mapStateToProps, actionsToProps)(Explorer)
export default VariableExplorer
diff --git a/reducers.js b/reducers.js
index bdd659258..f0b737040 100644
--- a/reducers.js
+++ b/reducers.js
@@ -2,12 +2,10 @@
import { combineReducers } from 'redux'
import { SELECT_TAG } from './actions'
-function selectTag(state = {}, action) {
- switch (action.type) {
+function selectedTags(state = [], {type, tagName, tagValue}) {
+ switch (type) {
case SELECT_TAG:
- return Object.assign({}, state, {
- [action.tagName]: action.tagValue
- })
+ return [...state, [tagName, tagValue]]
default:
return state
}
@@ -16,5 +14,5 @@ function selectTag(state = {}, action) {
export default combineReducers({
- selectTag
+ selectedTags
})