From e16ef7e975d8c13f5b994c0c122ee85cbccd2077 Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Wed, 20 Jun 2018 14:08:49 +0200 Subject: [PATCH] =?UTF-8?q?:bug:=20r=C3=A9pare=20le=20bouton=20d'aide=20ca?= =?UTF-8?q?ss=C3=A9=20suite=20=C3=A0=20la=20refacto=20du=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/Aide.js | 31 ++++++-------------- source/components/conversation/Explicable.js | 15 +++++----- 2 files changed, 17 insertions(+), 29 deletions(-) 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 && -

- {possibilities.length} possibilités : -

    - {possibilities.map(p => -
  • {p}
  • - )} -
-

- } */} {refs && (

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()