✨ pas de sélecteurs
parent
c7d0b5fd9c
commit
96446f6d75
|
@ -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 (
|
||||
<div id="GenericSimulation">
|
||||
<header>
|
||||
<img src="https://images.unsplash.com/photo-1530685932526-48ec92998eaa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80" />
|
||||
<h1>Quel est l'impact de votre véhicule ? </h1>
|
||||
</header>
|
||||
<div className="ui__ container" id="simulationContent">
|
||||
{!isEmpty(previousAnswers) && (
|
||||
<button
|
||||
style={{ background: colours.colour, color: colours.textColour }}
|
||||
onClick={() => this.setState({ displayAnswers: true })}>
|
||||
Mes réponses
|
||||
</button>
|
||||
)}
|
||||
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 (
|
||||
<div id="GenericSimulation">
|
||||
<header>
|
||||
<img src="https://images.unsplash.com/photo-1530685932526-48ec92998eaa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80" />
|
||||
<h1>Quel est l'impact de votre véhicule ? </h1>
|
||||
</header>
|
||||
<div className="ui__ container" id="simulationContent">
|
||||
{!isEmpty(previousAnswers) && (
|
||||
<button
|
||||
style={{
|
||||
background: colours.colour,
|
||||
color: colours.textColour
|
||||
}}
|
||||
onClick={() => this.setState({ displayAnswers: true })}>
|
||||
Mes réponses
|
||||
</button>
|
||||
)}
|
||||
|
||||
{this.state.displayAnswers && (
|
||||
<Answers onClose={() => this.setState({ displayAnswers: false })} />
|
||||
)}
|
||||
<Conversation
|
||||
textColourOnWhite={this.props.colours.textColourOnWhite}
|
||||
/>
|
||||
{noNextSteps && (
|
||||
<>
|
||||
<h2>Plus de questions ! </h2>
|
||||
<p>Vous avez atteint l'estimation la plus précise.</p>
|
||||
</>
|
||||
)}
|
||||
<Targets />
|
||||
{this.state.displayAnswers && (
|
||||
<Answers
|
||||
onClose={() => this.setState({ displayAnswers: false })}
|
||||
/>
|
||||
)}
|
||||
<Conversation
|
||||
textColourOnWhite={this.props.colours.textColourOnWhite}
|
||||
/>
|
||||
{noNextSteps && (
|
||||
<>
|
||||
<h2>Plus de questions ! </h2>
|
||||
<p>Vous avez atteint l'estimation la plus précise.</p>
|
||||
</>
|
||||
)}
|
||||
<Targets />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -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 (
|
||||
<div id="targets">
|
||||
<span className="icon">→</span>
|
||||
<span
|
||||
className="content"
|
||||
style={{ color: this.props.colours.textColour }}>
|
||||
{/*<span className="title">{title}</span>
|
||||
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 (
|
||||
<div id="targets">
|
||||
<span className="icon">→</span>
|
||||
<span
|
||||
className="content"
|
||||
style={{ color: this.props.colours.textColour }}>
|
||||
{/*<span className="title">{title}</span>
|
||||
{' : '} */}
|
||||
<span className="figure">
|
||||
<span className="value">{nodeValue?.toFixed(1)}</span>{' '}
|
||||
<span className="unit">{unit}</span>
|
||||
<span className="figure">
|
||||
<span className="value">{nodeValue?.toFixed(1)}</span>{' '}
|
||||
<span className="unit">{unit}</span>
|
||||
</span>
|
||||
<Link
|
||||
title="Quel est calcul ?"
|
||||
style={{ color: this.props.colours.colour }}
|
||||
to={'/règle/' + dottedName}
|
||||
className="explanation">
|
||||
{emoji('📖')}
|
||||
</Link>
|
||||
</span>
|
||||
<Link
|
||||
title="Quel est calcul ?"
|
||||
style={{ color: this.props.colours.colour }}
|
||||
to={'/règle/' + dottedName}
|
||||
className="explanation">
|
||||
{emoji('📖')}
|
||||
</Link>
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue