From 8b27f2c48e14468785eb04089cdda7f42b7ca619 Mon Sep 17 00:00:00 2001 From: Mael Date: Sun, 11 Nov 2018 15:58:34 +0000 Subject: [PATCH] =?UTF-8?q?Composant=20pour=20la=20simulation=20g=C3=A9n?= =?UTF-8?q?=C3=A9rique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/GenericSimulation.js | 28 +++++++++++++++++++++++++- source/components/Targets.js | 16 +++++++++++++++ source/components/ui/themeColours.js | 2 +- source/engine/rules.js | 2 +- source/règles/co2.yaml | 8 +++++--- source/sites/publi.codes/App.js | 5 ++++- 6 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 source/components/Targets.js diff --git a/source/components/GenericSimulation.js b/source/components/GenericSimulation.js index ceed236cc..523590e72 100644 --- a/source/components/GenericSimulation.js +++ b/source/components/GenericSimulation.js @@ -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 () =>
Salut, toi
+@withColours +export default class YO extends React.Component { + state = { + displayAnswers: false + } + render() { + return ( +
+ + + {this.state.displayAnswers && ( + this.setState({ displayAnswers: false })} /> + )} + + +
+ ) + } +} diff --git a/source/components/Targets.js b/source/components/Targets.js new file mode 100644 index 000000000..006215647 --- /dev/null +++ b/source/components/Targets.js @@ -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 ( +
+ {title}{' '} + {nodeValue} +
+ ) + } +} diff --git a/source/components/ui/themeColours.js b/source/components/ui/themeColours.js index d952abde1..f9238c0f5 100644 --- a/source/components/ui/themeColours.js +++ b/source/components/ui/themeColours.js @@ -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), diff --git a/source/engine/rules.js b/source/engine/rules.js index 5236a11e1..7ee20bfe0 100644 --- a/source/engine/rules.js +++ b/source/engine/rules.js @@ -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, diff --git a/source/règles/co2.yaml b/source/règles/co2.yaml index 025226a87..d94a0b3c2 100644 --- a/source/règles/co2.yaml +++ b/source/règles/co2.yaml @@ -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 diff --git a/source/sites/publi.codes/App.js b/source/sites/publi.codes/App.js index 6d4c610d7..295c34036 100644 --- a/source/sites/publi.codes/App.js +++ b/source/sites/publi.codes/App.js @@ -10,7 +10,10 @@ import GenericSimulation from 'Components/GenericSimulation' class App extends Component { render() { return ( - +