diff --git a/source/components/Simulateur.js b/source/components/Simulateur.js index 7a16e05ff..d2947bd87 100644 --- a/source/components/Simulateur.js +++ b/source/components/Simulateur.js @@ -6,7 +6,12 @@ import { connect } from 'react-redux' import { withRouter, Redirect } from 'react-router-dom' import { START_CONVERSATION } from '../actions' -import { rules, findRuleByName, decodeRuleName } from 'Engine/rules' +import { + rules, + findRuleByName, + findRuleByDottedName, + decodeRuleName +} from 'Engine/rules' import './conversation/conversation.css' import './Simulateur.css' import Conversation from './conversation/Conversation' @@ -31,7 +36,7 @@ import Explanation from 'Components/Explanation' analysis: state.analysis }), dispatch => ({ - startConversation: (targetNames, fromScratch=false) => + startConversation: (targetNames, fromScratch = false) => dispatch({ type: START_CONVERSATION, targetNames, fromScratch }), resetForm: () => dispatch(reset('conversation')), resetFormField: name => dispatch(change('conversation', name, '')) @@ -117,7 +122,11 @@ export default class extends Component { }} /> - {done && } + {done && ( + + )} ) } @@ -130,10 +139,10 @@ export default class extends Component { let step = makeQuestion(rules, targetNames)(question) let fieldName = - (unfolded && - inputInversions && - R.path(step.dottedName.split('.'), inputInversions)) || - step.dottedName + (inputInversions && + R.path(step.dottedName.split('.'), inputInversions)) || + step.dottedName, + fieldTitle = findRuleByDottedName(rules, fieldName).title return ( ) diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 29e00eb62..401939a41 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -144,10 +144,10 @@ export var FormDecorator = formType => RenderField => stepAction, situationGate, themeColours, - step: { title }, - fieldName + step: { title, dottedName }, + fieldName, + fieldTitle } = this.props - let inversionTitle = R.path(['props', 'step', 'inversion', 'title'])(this) let answer = situationGate(fieldName) @@ -155,13 +155,13 @@ export var FormDecorator = formType => RenderField =>
- {capitalise0(inversionTitle || title)} + {capitalise0(fieldTitle || title)} {answer}