import { resetSimulation } from 'Actions/actions' import { React, T } from 'Components' import Answers from 'Components/AnswerList' import Conversation from 'Components/conversation/Conversation' import withColours from 'Components/utils/withColours' import { compose } from 'ramda' import { connect } from 'react-redux' import { nextStepsSelector, noUserInputSelector } from 'Selectors/analyseSelectors' import Animate from 'Ui/animate' export default compose( withColours, connect( state => ({ conversationStarted: state.conversationStarted, previousAnswers: state.conversationSteps.foldedSteps, noNextSteps: state.conversationStarted && nextStepsSelector(state).length == 0, noUserInput: noUserInputSelector(state) }), { resetSimulation } ) )( class Simulation extends React.Component { state = { displayAnswers: false } render() { let { noNextSteps, previousAnswers, noUserInput, conversationStarted, resetSimulation, showTargetsAnyway, targetsTriggerConversation } = this.props let arePreviousAnswers = previousAnswers.length > 0, displayConversation = !targetsTriggerConversation || conversationStarted, showTargets = targetsTriggerConversation || !noUserInput || showTargetsAnyway return ( <> {this.state.displayAnswers && ( this.setState({ displayAnswers: false })} /> )}
{arePreviousAnswers ? ( ) : ( )} {displayConversation && ( )}
{displayConversation && ( <> {noNextSteps && ( <>

Plus de questions !

Vous avez atteint l'estimation la plus précise. {this.props.customEndMessages} )} )} {showTargets && ( {this.props.targets} )} {!noUserInput && this.props.explanation} ) } } )