diff --git a/source/components/Aide.js b/source/components/Aide.js index 5f6b75de3..8e9ce7487 100644 --- a/source/components/Aide.js +++ b/source/components/Aide.js @@ -1,29 +1,28 @@ -import React, { Component } from 'react' -import { connect } from 'react-redux' - import marked from 'Engine/marked' import { findRuleByDottedName } from 'Engine/rules' +import React, { Component } from 'react' +import { connect } from 'react-redux' +import { flatRulesSelector } from 'Selectors/analyseSelectors' import { EXPLAIN_VARIABLE } from '../actions' - -import References from './rule/References' import './Aide.css' - +import References from './rule/References' +import withColours from './withColours' @connect( state => ({ explained: state.explainedVariable, - themeColours: state.themeColours, - flatRules: state.flatRules + flatRules: flatRulesSelector(state) }), dispatch => ({ stopExplaining: () => dispatch({ type: EXPLAIN_VARIABLE }) }) ) +@withColours export default class Aide extends Component { renderExplanationMarkdown(explanation, term) { return marked(`### ${term} \n\n${explanation}`) } render() { - let { flatRules, explained, stopExplaining, themeColours } = this.props + let { flatRules, explained, stopExplaining, colours } = this.props if (!explained) return @@ -31,31 +30,19 @@ export default class Aide extends Component { text = rule.description, refs = rule.références - let possibilities = rule['choix exclusifs'] - return (
- {possibilities.length} possibilités : -
Pour en savoir plus:
diff --git a/source/components/conversation/Explicable.js b/source/components/conversation/Explicable.js index d6ce22b8d..7b08b2ca8 100644 --- a/source/components/conversation/Explicable.js +++ b/source/components/conversation/Explicable.js @@ -1,12 +1,11 @@ -import React from 'react' import classNames from 'classnames' -import './Explicable.css' -import { connect } from 'react-redux' -import { EXPLAIN_VARIABLE } from '../../actions' import { findRuleByDottedName } from 'Engine/rules' +import React from 'react' +import { connect } from 'react-redux' import { flatRulesSelector } from 'Selectors/analyseSelectors' - -import ReactPiwik from '../Tracker' +import { EXPLAIN_VARIABLE } from '../../actions' +import withTracker from '../withTracker' +import './Explicable.css' @connect( state => ({ @@ -18,6 +17,7 @@ import ReactPiwik from '../Tracker' explain: variableName => dispatch({ type: EXPLAIN_VARIABLE, variableName }) }) ) +@withTracker export default class Explicable extends React.Component { render() { let { @@ -25,6 +25,7 @@ export default class Explicable extends React.Component { dottedName, explain, explained, + tracker, textColourOnWhite } = this.props @@ -46,7 +47,7 @@ export default class Explicable extends React.Component { { - ReactPiwik.push(['trackEvent', 'help', dottedName]) + tracker.push(['trackEvent', 'help', dottedName]) explain(dottedName) e.preventDefault() e.stopPropagation()