import R from 'ramda' import React, { Component } from 'react' import classNames from 'classnames' import {Link} from 'react-router-dom' import {connect} from 'react-redux' import { withRouter } from 'react-router' import './Results.css' import {clearDict} from 'Engine/traverse' import {encodeRuleName} from 'Engine/rules' import {getObjectives} from 'Engine/generateQuestions' import RuleValueVignette from './rule/RuleValueVignette' @withRouter @connect( state => ({ analysedSituation: state.analysedSituation, conversationStarted: !R.isEmpty(state.form), conversationFirstAnswer: R.path(['form', 'conversation', 'values'])(state), situationGate: state.situationGate }) ) export default class Results extends Component { componentDidMount(){ setTimeout(() => this.props.setElementHeight(this.el.offsetHeight) , 1) } render() { let { analysedSituation, conversationStarted, conversationFirstAnswer: showResults, situationGate, location } = this.props let explanation = R.has('root', analysedSituation) && clearDict() && getObjectives(situationGate, analysedSituation.root, analysedSituation.parsedRules) if (!explanation) return null let onRulePage = R.contains('/regle/')(location.pathname) return (
this.el = el} id="results" className={classNames({show: showResults})}> {onRulePage && conversationStarted ?
Reprendre la simulation
:

{explanation.length == 1 ? 'Votre résultat' : 'Vos résultats'}·Cliquez pour comprendre chaque calcul

}
) } }