diff --git a/source/components/GenericSimulation.js b/source/components/GenericSimulation.js index b7af2f6ad..cae244d45 100644 --- a/source/components/GenericSimulation.js +++ b/source/components/GenericSimulation.js @@ -1,6 +1,6 @@ import React from 'react' import { connect } from 'react-redux' -import { isEmpty } from 'ramda' +import { isEmpty, compose } from 'ramda' import Answers from 'Components/AnswerList' import Conversation from 'Components/conversation/Conversation' import withColours from 'Components/utils/withColours' @@ -8,48 +8,56 @@ import Targets from 'Components/Targets' import './GenericSimulation.css' import { nextStepsSelector } from 'Selectors/analyseSelectors' -@withColours -@connect(state => ({ - previousAnswers: state.conversationSteps.foldedSteps, - noNextSteps: nextStepsSelector(state).length == 0 -})) -export default class YO extends React.Component { - state = { - displayAnswers: false - } - render() { - let { colours, noNextSteps, previousAnswers } = this.props - console.log(noNextSteps) - return ( -
-
- -

Quel est l'impact de votre véhicule ?

-
-
- {!isEmpty(previousAnswers) && ( - - )} +export default compose( + withColours, + connect(state => ({ + previousAnswers: state.conversationSteps.foldedSteps, + noNextSteps: nextStepsSelector(state).length == 0 + })) +)( + class YO extends React.Component { + state = { + displayAnswers: false + } + render() { + let { colours, noNextSteps, previousAnswers } = this.props + console.log(noNextSteps) + return ( +
+
+ +

Quel est l'impact de votre véhicule ?

+
+
+ {!isEmpty(previousAnswers) && ( + + )} - {this.state.displayAnswers && ( - this.setState({ displayAnswers: false })} /> - )} - - {noNextSteps && ( - <> -

Plus de questions !

-

Vous avez atteint l'estimation la plus précise.

- - )} - + {this.state.displayAnswers && ( + this.setState({ displayAnswers: false })} + /> + )} + + {noNextSteps && ( + <> +

Plus de questions !

+

Vous avez atteint l'estimation la plus précise.

+ + )} + +
-
- ) + ) + } } -} +) diff --git a/source/components/Targets.js b/source/components/Targets.js index c7f3137bb..ed6afe1fe 100644 --- a/source/components/Targets.js +++ b/source/components/Targets.js @@ -5,38 +5,41 @@ import './Targets.css' import withColours from 'Components/utils/withColours' import { Link } from 'react-router-dom' import emoji from 'react-easy-emoji' - -@connect(state => ({ analysis: analysisWithDefaultsSelector(state) })) -@withColours -export default class Targets extends React.Component { - render() { - let { - title, - nodeValue, - unité: unit, - dottedName - } = this.props.analysis.targets[0] - return ( -
- - - {/*{title} +import { compose } from 'ramda' +export default compose( + connect(state => ({ analysis: analysisWithDefaultsSelector(state) })), + withColours +)( + class Targets extends React.Component { + render() { + let { + title, + nodeValue, + unité: unit, + dottedName + } = this.props.analysis.targets[0] + return ( +
+ + + {/*{title} {' : '} */} - - {nodeValue?.toFixed(1)}{' '} - {unit} + + {nodeValue?.toFixed(1)}{' '} + {unit} + + + {emoji('📖')} + - - {emoji('📖')} - - -
- ) +
+ ) + } } -} +)