import React, {Component} from 'react'
import './CDD.css'
import Results from './Results'
import {reduxForm, formValueSelector} from 'redux-form'
import {connect} from 'react-redux'
import './conversation/conversation.css'
import {START_CONVERSATION} from '../actions'
import Aide from './Aide'
import PageTypeIcon from './PageTypeIcon'
let situationSelector = formValueSelector('conversation')
@reduxForm({form: 'conversation', destroyOnUnmount: false})
@connect(
state => ({
situation: variableName => situationSelector(state, variableName),
foldedSteps: state.foldedSteps,
unfoldedSteps: state.unfoldedSteps,
themeColours: state.themeColours,
analysedSituation: state.analysedSituation,
}),
dispatch => ({
startConversation: () => dispatch({type: START_CONVERSATION}),
}),
)
export default class CDD extends Component {
componentDidMount() {
// C'est ici que la génération du formulaire, et donc la traversée des variables commence
this.props.startConversation()
}
render() {
let {foldedSteps, unfoldedSteps, situation} = this.props
let conversation = foldedSteps
.map(step => (
Nous n'avons plus de questions : votre simulation est terminée.
Une remarque ? Écrivez-nous {' '} {' '} !