From bb45fb3ee1e7cb8bffb7cba4720060ef325f62c8 Mon Sep 17 00:00:00 2001 From: mama Date: Wed, 15 Nov 2017 15:07:39 +0100 Subject: [PATCH] :fire: Nettoyage de FormDecorator --- .../components/conversation/FormDecorator.js | 47 +++++-------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 0eaa1b367..0c0e236ad 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -44,16 +44,9 @@ export var FormDecorator = formType => RenderField => possibleChoice, // should be found in the question set theoritically, but it is used for a single choice question -> the question itself is dynamic and cannot be input as code, // formerly in conversation-steps valueType, - attributes, - choices, - optionsURL, human, - helpText, - suggestions, - subquestion, - inversions + helpText } = this.props.step - this.step = this.props.step let { fieldName } = this.state @@ -63,17 +56,10 @@ export var FormDecorator = formType => RenderField => des balises html, dans notre cas. */ let stepProps = { - attributes /* Input component's html attributes */, - choices /* Question component's radio choices */, - optionsURL /* Select component's data source */, - possibleChoice /* RhetoricalQuestion component's only choice :'-( */, + ...this.props.step, //TODO hack, enables redux-form/CHANGE to update the form state before the traverse functions are run submit: () => setTimeout(() => stepAction('fold', fieldName), 1), - setFormValue: value => setFormValue(fieldName, value), - valueType, - suggestions, - subquestion, - inversions + setFormValue: value => setFormValue(fieldName, value) } /* There won't be any answer zone here, widen the question zone */ @@ -94,8 +80,7 @@ export var FormDecorator = formType => RenderField => valueType, human, helpText, - wideQuestion, - subquestion + wideQuestion )} {unfolded && (
@@ -117,14 +102,8 @@ export var FormDecorator = formType => RenderField => /* < Le titre de ma question > ----------- < (? bulle d'aide) OU résultat > */ - renderHeader( - unfolded, - valueType, - human, - helpText, - wideQuestion, - subquestion - ) { + renderHeader(unfolded, valueType, human, helpText, wideQuestion) { + let { subquestion } = this.props.step return ( {unfolded @@ -155,13 +134,13 @@ export var FormDecorator = formType => RenderField => renderTitleAndAnswer(valueType, human) { let { - name, - stepAction, - answer, - themeColours, - step: { title } - } = this.props, - ignored = this.step.state === 'ignored' + name, + stepAction, + answer, + themeColours, + step: { title } + } = this.props + return (