diff --git a/source/components/Simulateur.js b/source/components/Simulateur.js index 8741a1b4a..c49276063 100644 --- a/source/components/Simulateur.js +++ b/source/components/Simulateur.js @@ -97,7 +97,7 @@ export default class extends Component { ) } - buildStep = ({ unfolded }) => (accessor, targetNames) => question => { + buildStep = ({ unfolded }) => (situationGate, targetNames) => question => { let step = makeQuestion(rules, targetNames)(question) return ( ) } diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 22a70f8f0..471550962 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -5,7 +5,7 @@ import { Field, change } from 'redux-form' import { stepAction } from '../../actions' import StepAnswer from './StepAnswer' import { capitalise0 } from '../../utils' - +import R from 'ramda' /* This higher order component wraps "Form" components (e.g. Question.js), that represent user inputs, with a header, click actions and more goodies. @@ -45,7 +45,8 @@ export var FormDecorator = formType => RenderField => // formerly in conversation-steps valueType, human, - helpText + helpText, + situationGate } = this.props.step let { fieldName } = this.state @@ -123,7 +124,8 @@ export var FormDecorator = formType => RenderField => maxWidth: wideQuestion ? '95%' : '' }} > - {this.props.step.question} + {R.path(['props', 'step', 'inversion', 'question'])(this) || + this.props.step.question}
RenderField => ) renderTitleAndAnswer(valueType, human) { - let { - stepAction, - answer, - themeColours, - step: { title } - } = this.props - + let { step, stepAction, situationGate, themeColours, step: { title } } = this.props + let inversionTitle = R.path(['props', 'step', 'inversion', 'title'])(this) + let answer = situationGate(this.state.fieldName) return (
- {capitalise0(title)} + {capitalise0(inversionTitle || title)} {answer}