Les prélèvements sociaux sur les salaires
-
+
{variables.map((v, i) => )}
@@ -30,33 +25,13 @@ class Explorer extends React.Component {
}
}
-class TagSelect extends React.Component {
- render(){
- let {tag: {name, choices, number}, selectTag} = this.props
- return (
- {`${name} (${number} variables)`}
-
- {[...choices].map(c =>
- - selectTag(name, c)}>
- {c}
-
- )}
-
- )
- }
-}
const mapStateToProps = state => (
{
- variables: selectVariables(state),
- tags: selectTagStats(state)
+ variables: getVariables(state)
}
)
-const actionsToProps = dispatch => ({
- actions: bindActionCreators(actions, dispatch),
-})
-
-const VariableExplorer = connect(mapStateToProps, actionsToProps)(Explorer)
+const VariableExplorer = connect(mapStateToProps)(Explorer)
export default VariableExplorer
diff --git a/selectors.js b/selectors.js
index 14f050755..2f8f8a61f 100644
--- a/selectors.js
+++ b/selectors.js
@@ -20,7 +20,7 @@ const unorderedTagStats = finalVariables =>
.sort((a, b) => b.number - a.number)
-export const selectVariables = createSelector(
+export const getVariables = createSelector(
[state => state.selectedTags],
tags =>
finalVariables.filter(variable =>
@@ -29,9 +29,13 @@ export const selectVariables = createSelector(
)
)
-export const selectTagStats = createSelector(
- [selectVariables],
- variables => {
- return tagStats(unorderedTagStats(variables))
- }
+const getTagStats = createSelector(
+ [getVariables],
+ variables => tagStats(unorderedTagStats(variables))
+)
+
+export const getTagsToSelect = createSelector(
+ [getTagStats, state => state.selectedTags],
+ (availableTags, selectedTags) =>
+ availableTags.filter(t => !selectedTags.find(([name]) => t.name === name))
)