diff --git a/components/SelectedVariable.css b/components/SelectedVariable.css
new file mode 100644
index 000000000..71bbaa475
--- /dev/null
+++ b/components/SelectedVariable.css
@@ -0,0 +1,50 @@
+#calculable-items>li {
+ margin-top: 4em;
+ padding-bottom: 2em;
+ border-bottom: 1px solid #eee;
+}
+
+.item .left {
+ display: inline-block;
+ width: 30%;
+}
+.item .right {
+ display: inline-block;
+ width: 40%;
+}
+/* Display formulas */
+
+.calc {
+ text-align: center;
+}
+.calc h3 {
+ font-weight: 300;
+ font-size: 100%;
+ color: #666;
+ text-transform: uppercase;
+}
+.linear {
+ font-size: 130%;
+}
+.linear .label {
+ font-size: 70%;
+ color: #333;
+ color: #2980b9;
+}
+
+.linear .operator {
+ margin: 0 1em;
+ color: #2980b9;
+ font-size: 150%;
+}
+
+.linear .limit {
+ margin-top: 1em;
+}
+.linear .limit .label {
+ margin-right: 1em;
+}
+
+.linear .base, .calc .rate {
+ display: inline-block;
+}
diff --git a/components/SelectedVariable.js b/components/SelectedVariable.js
index 4836036ee..9dcf75ba5 100644
--- a/components/SelectedVariable.js
+++ b/components/SelectedVariable.js
@@ -1,4 +1,7 @@
import React, { Component } from 'react'
+import './SelectedVariable.css'
+import TagMap from './TagMap'
+import R from 'ramda'
export default class SelectedVariable extends Component {
render() {
@@ -8,14 +11,26 @@ export default class SelectedVariable extends Component {
first: {
description
},
- tags
+ tags,
+ calculable
},
selectedTags
- } = this.props
+ } = this.props,
+
+ tagsList = R.pluck('tags', calculable),
+ commonTags = R.tail(tagsList).reduce(
+ (result, next) => R.intersection(result, R.toPairs(next)),
+ R.toPairs(R.head(tagsList))
+ ),
+ itemsWithUniqueTags = R.map(item => [item, R.fromPairs(R.difference(R.toPairs(item.tags), commonTags))], calculable)
+
+
return (
{name}
{description}
+
+ {/*
{Object.keys(tags)
.filter(name => !selectedTags.find(([n]) => name == n))
@@ -25,6 +40,67 @@ export default class SelectedVariable extends Component {
)}
+ */}
+
)
}
}
+
+class Items extends Component {
+ render() {
+ let {itemsWithUniqueTags} = this.props
+
+ return (
+
+ {itemsWithUniqueTags.map(([item, tags], i) =>
+ -
+ )}
+
+ )
+ }
+}
+
+let Item = ({item: {linear, marginalRateTaxScale}, tags}) =>
+
+
+
+
+
+ { linear &&
+ || marginalRateTaxScale &&
+ }
+
+
+
+
+let Linear = ({data: {
+ base,
+ limit,
+ historique
+}}) =>
+
Calcul linéaire
+
+
+
+ ✕
+
+
+
Taux
+
{
+ historique[(Object.keys(historique).sort()[0])]
+ }
+
+ { limit != null &&
+ dans la limite de :
+ {limit}
+
}
+
+
+
+let TaxScale = ({data}) =>
+
Règle de calcul: barème
+ {JSON.stringify(data)}
+
diff --git a/components/TagMap.js b/components/TagMap.js
new file mode 100644
index 000000000..b84639aa0
--- /dev/null
+++ b/components/TagMap.js
@@ -0,0 +1,13 @@
+import React from 'react'
+import R from 'ramda'
+
+let TagMap = ({data}) =>
+
+ {R.unless(R.isArrayLike, R.toPairs)(data).map(([name, value]) => -
+ {name} :
+ {value}
+
)
+ }
+
+
+export default TagMap
diff --git a/components/TagNavigation.js b/components/TagNavigation.js
index 600eb9671..538713311 100644
--- a/components/TagNavigation.js
+++ b/components/TagNavigation.js
@@ -1,5 +1,5 @@
import React from 'react'
-
+import TagMap from './TagMap'
export default class TagNavigation extends React.Component {
render(){
@@ -10,13 +10,7 @@ export default class TagNavigation extends React.Component {
{selectedTags.length > 0 &&
-
- {selectedTags.map(([name, value]) => -
- {name}:
- {value}
-
)
- }
-
+
}
@@ -38,7 +32,7 @@ class Tag extends React.Component {
{name}
- ({number} variables)
+ ({number} variable{number > 1 ? 's' : ''})
diff --git a/containers/App.css b/containers/App.css
index e8d28f756..320570dd7 100644
--- a/containers/App.css
+++ b/containers/App.css
@@ -73,11 +73,13 @@ li {
color: #16a085;
}
-#selected .tag-value {
+.tag-map .tag-value {
margin-left: 1em;
- border: 1px solid #16a085;
- color: #16a085;
+ background: #16a085;
+ border: none;
+ color: white;
margin-bottom: .5em;
+ cursor: default;
}
#selected button {
@@ -132,5 +134,4 @@ li {
border: 1px solid #ddd;
border-left: 2px solid #ddd;
padding: 1em 2em;
-
}
diff --git a/reducers.js b/reducers.js
index a4f84b5fe..0942770ed 100644
--- a/reducers.js
+++ b/reducers.js
@@ -13,7 +13,7 @@ function selectedTags(state = [], {type, tagName, tagValue}) {
}
}
-function selectedVariable(state = null, {type, name}) {
+function selectedVariable(state = 'chomage', {type, name}) {
switch (type) {
case SELECT_VARIABLE:
return name