Ajout experimental du composant question aux pages /regle

pull/337/head
Mael 2018-09-06 18:49:59 +02:00
parent 94e7615360
commit c2957e291a
2 changed files with 16 additions and 3 deletions

View File

@ -18,7 +18,6 @@ import './conversation.css'
})
@translate()
@connect(state => ({
targetNames: state.targetNames,
conversationStarted: state.conversationStarted,
themeColours: state.themeColours,
flatRules: flatRulesSelector(state),
@ -26,7 +25,7 @@ import './conversation.css'
}))
export default class Conversation extends Component {
render() {
let { currentQuestion, flatRules, targetNames } = this.props
let { currentQuestion, flatRules } = this.props
return (
<div className="conversationContainer">
<Aide />
@ -34,7 +33,7 @@ export default class Conversation extends Component {
{currentQuestion && (
<Animate.fadeIn>
<Scroll.toElement onlyIfNotVisible />
{getInputComponent(flatRules, targetNames)(currentQuestion)}
{getInputComponent(flatRules)(currentQuestion)}
</Animate.fadeIn>
)}
</div>

View File

@ -1,4 +1,5 @@
import withColours from 'Components/utils/withColours'
import { getInputComponent } from 'Engine/generateQuestions'
import { createMarkdownDiv } from 'Engine/marked'
import {
encodeRuleName,
@ -22,6 +23,7 @@ import Examples from './Examples'
import RuleHeader from './Header'
import References from './References'
import './Rule.css'
import { reduxForm } from 'redux-form'
@connect((state, props) => ({
currentExample: state.currentExample,
@ -69,6 +71,7 @@ export default class Rule extends Component {
/>
<section id="rule-content">
{flatRule.question && <UserInput {...{ flatRules, dottedName }} />}
{flatRule.ns && (
<Algorithm
rule={displayedRule}
@ -149,3 +152,14 @@ let ReportError = ({ name }) => (
</a>
</div>
)
@reduxForm({
form: 'conversation',
destroyOnUnmount: false
})
class UserInput extends Component {
render() {
let { flatRules, dottedName } = this.props
return getInputComponent(flatRules)(dottedName)
}
}