import React, {Component} from 'react' import {connect} from 'react-redux' import {findRuleByName} from '../engine/rules' import './Aide.css' import {EXPLAIN_VARIABLE} from '../actions' import References from './References' @connect( state => ({explained: state.explainedVariable}), dispatch => ({ stopExplaining: () => dispatch( {type: EXPLAIN_VARIABLE}) }) ) export default class Aide extends Component { render() { let {explained, stopExplaining} = this.props if (!explained) return
let rule = findRuleByName(explained), text = rule.description || rule.titre, refs = rule.références let possibilities = rule['choix exclusifs'] return (

{text}

{ possibilities &&

{possibilities.length} possibilités :

} {refs &&

Pour en savoir plus:

}
) } }