Composant pour la simulation générique
parent
ed492ebb10
commit
8b27f2c48e
|
@ -1,3 +1,29 @@
|
|||
import React from 'react'
|
||||
import Answers from 'Components/AnswerList'
|
||||
import Conversation from 'Components/conversation/Conversation'
|
||||
import withColours from 'Components/utils/withColours'
|
||||
import Targets from 'Components/Targets'
|
||||
|
||||
export default () => <div>Salut, toi</div>
|
||||
@withColours
|
||||
export default class YO extends React.Component {
|
||||
state = {
|
||||
displayAnswers: false
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<button onClick={() => this.setState({ displayAnswers: true })}>
|
||||
Mes réponses
|
||||
</button>
|
||||
|
||||
{this.state.displayAnswers && (
|
||||
<Answers onClose={() => this.setState({ displayAnswers: false })} />
|
||||
)}
|
||||
<Conversation
|
||||
textColourOnWhite={this.props.colours.textColourOnWhite}
|
||||
/>
|
||||
<Targets />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import React from 'react'
|
||||
import { analysisWithDefaultsSelector } from 'Selectors/analyseSelectors'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
@connect(state => ({ analysis: analysisWithDefaultsSelector(state) }))
|
||||
export default class Targets extends React.Component {
|
||||
render() {
|
||||
let { title, nodeValue } = this.props.analysis.targets[0]
|
||||
return (
|
||||
<div>
|
||||
<span className="targetTitle">{title}</span>{' '}
|
||||
<span className="targetValue">{nodeValue}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ const lightenColour = (hex, x) => {
|
|||
}
|
||||
export default forcedThemeColour => {
|
||||
let // Use the default theme colour if the host page hasn't made a choice
|
||||
defaultColour = '#2975D1',
|
||||
defaultColour = '#27ae60',
|
||||
colour = forcedThemeColour || defaultColour,
|
||||
lightColour = lightenColour(colour, 10),
|
||||
darkColour = lightenColour(colour, -10),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Séparation artificielle, temporaire, entre ces deux types de règles
|
||||
import rawRules from 'Règles/base.yaml'
|
||||
import rawRules from 'Règles/co2.yaml'
|
||||
import translations from 'Règles/externalized.yaml'
|
||||
import {
|
||||
assoc,
|
||||
|
|
|
@ -10,13 +10,15 @@
|
|||
|
||||
- nom: nombre de douches
|
||||
période: flexible
|
||||
question: Combien prenez-vous de douches par ?
|
||||
question: Combien prenez-vous de douches ?
|
||||
format: nombre
|
||||
par défaut: 30
|
||||
suggestions:
|
||||
- 30
|
||||
Une par jour: 30
|
||||
|
||||
- nom: impact par douche
|
||||
formule: impact par litre * litres d'eau
|
||||
formule: 4
|
||||
# formule: impact par litre * litres d'eau
|
||||
|
||||
- nom: impact par litre
|
||||
formule: impact par litre froid + chauffage . impact par litre
|
||||
|
|
|
@ -10,7 +10,10 @@ import GenericSimulation from 'Components/GenericSimulation'
|
|||
class App extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Provider basename="embauche" initialStore={{}} reduxMiddlewares={[]}>
|
||||
<Provider
|
||||
basename="embauche"
|
||||
initialStore={{ targetNames: ['impact'] }}
|
||||
reduxMiddlewares={[]}>
|
||||
<Switch>
|
||||
<Route exact path="/" component={GenericSimulation} />
|
||||
<Route path="/règle/:name" component={RulePage} />
|
||||
|
|
Loading…
Reference in New Issue