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 {capitalise0} from '../utils' import {computeRuleValue} from 'Engine/traverse' import {encodeRuleName} from 'Engine/rules' import {getObjectives} from 'Engine/generateQuestions' let fmt = new Intl.NumberFormat('fr-FR').format let humanFigure = decimalDigits => value => fmt(value.toFixed(decimalDigits)) @withRouter @connect( state => ({ pointedOutObjectives: state.pointedOutObjectives, analysedSituation: state.analysedSituation, conversationStarted: !R.isEmpty(state.form), conversationFirstAnswer: R.path(['form', 'conversation', 'values'])(state) }) ) export default class Results extends Component { render() { let { analysedSituation, pointedOutObjectives, conversationStarted, conversationFirstAnswer: showResults, location } = this.props, explanation = getObjectives(analysedSituation) if (!explanation) return null let onRulePage = R.contains('/regle/')(location.pathname) return (
{onRulePage && conversationStarted ?
Reprendre la simulation
:

Vos résultats

{do {let text = R.path(['simulateur', 'résultats'])(analysedSituation) text &&

{text}

}}

Cliquez pour comprendre chaque calcul

}
) } }