2018-10-21 17:06:04 +00:00
|
|
|
import React from 'react'
|
2018-11-11 21:54:17 +00:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { isEmpty } from 'ramda'
|
2018-11-11 15:58:34 +00:00
|
|
|
import Answers from 'Components/AnswerList'
|
|
|
|
import Conversation from 'Components/conversation/Conversation'
|
|
|
|
import withColours from 'Components/utils/withColours'
|
|
|
|
import Targets from 'Components/Targets'
|
2018-11-11 21:54:17 +00:00
|
|
|
import './GenericSimulation.css'
|
2018-11-16 16:02:19 +00:00
|
|
|
import { nextStepsSelector } from 'Selectors/analyseSelectors'
|
2018-10-21 17:06:04 +00:00
|
|
|
|
2018-11-11 15:58:34 +00:00
|
|
|
@withColours
|
2018-11-11 21:54:17 +00:00
|
|
|
@connect(state => ({
|
2018-11-16 16:02:19 +00:00
|
|
|
previousAnswers: state.conversationSteps.foldedSteps,
|
|
|
|
noNextSteps: nextStepsSelector(state).length == 0
|
2018-11-11 21:54:17 +00:00
|
|
|
}))
|
2018-11-11 15:58:34 +00:00
|
|
|
export default class YO extends React.Component {
|
|
|
|
state = {
|
|
|
|
displayAnswers: false
|
|
|
|
}
|
|
|
|
render() {
|
2018-11-16 16:02:19 +00:00
|
|
|
let { colours, noNextSteps, previousAnswers } = this.props
|
|
|
|
console.log(noNextSteps)
|
2018-11-11 15:58:34 +00:00
|
|
|
return (
|
2018-11-11 21:54:17 +00:00
|
|
|
<div className="ui__ container" id="GenericSimulation">
|
|
|
|
<h1>Quel est l'impact de vos douches ? </h1>
|
2018-11-16 16:02:19 +00:00
|
|
|
{!isEmpty(previousAnswers) && (
|
2018-11-11 21:54:17 +00:00
|
|
|
<button
|
|
|
|
style={{ background: colours.colour, color: colours.textColour }}
|
|
|
|
onClick={() => this.setState({ displayAnswers: true })}>
|
|
|
|
Mes réponses
|
|
|
|
</button>
|
|
|
|
)}
|
2018-11-11 15:58:34 +00:00
|
|
|
|
|
|
|
{this.state.displayAnswers && (
|
|
|
|
<Answers onClose={() => this.setState({ displayAnswers: false })} />
|
|
|
|
)}
|
|
|
|
<Conversation
|
|
|
|
textColourOnWhite={this.props.colours.textColourOnWhite}
|
|
|
|
/>
|
2018-11-16 16:02:19 +00:00
|
|
|
{noNextSteps && (
|
|
|
|
<>
|
|
|
|
<h2>Plus de questions ! </h2>
|
|
|
|
<p>Vous avez atteint l'estimation la plus précise.</p>
|
|
|
|
</>
|
|
|
|
)}
|
2018-11-11 15:58:34 +00:00
|
|
|
<Targets />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|