/* @flow */ 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 emoji from 'react-easy-emoji' import { connect } from 'react-redux' import { nextStepsSelector, noUserInputSelector } from 'Selectors/analyseSelectors' 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 || showTargetsAnyway return ( <> {this.state.displayAnswers && ( this.setState({ displayAnswers: false })} /> )} <>
{arePreviousAnswers ? ( ) : ( )} {displayConversation && !noUserInput && ( )}
{displayConversation && (!noNextSteps ? ( ) : ( <>

{emoji('🌟')}{' '} Situation complétée à 100%{' '}

Nous n'avons plus de questions à poser, vous avez atteint l'estimation la plus précise. {this.props.customEndMessages}

))} {showTargets && this.props.targets} ) } } )