import React, {Component} from 'react'
import {connect} from 'react-redux'
import {findRuleByDottedName} from '../engine/rules'
import './Aide.css'
import {EXPLAIN_VARIABLE} from '../actions'
import References from './References'
import marked from '../engine/marked'
@connect(
state =>
({explained: state.explainedVariable}),
dispatch => ({
stopExplaining: () => dispatch(
{type: EXPLAIN_VARIABLE})
})
)
export default class Aide extends Component {
renderExplanationMarkdown(explanation, term) {
return marked(`### ${term} \n\n${explanation}`)
}
render() {
let {explained, stopExplaining} = this.props
if (!explained) return
let rule = findRuleByDottedName(explained),
text = rule.description,
refs = rule.références
let possibilities = rule['choix exclusifs']
return (
{possibilities.length} possibilités :
{possibilities.map(p =>
Pour en savoir plus: