2018-01-03 15:54:19 +00:00
|
|
|
import R from 'ramda'
|
|
|
|
import React, { Component } from 'react'
|
|
|
|
import classNames from 'classnames'
|
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router'
|
2017-07-02 17:12:02 +00:00
|
|
|
|
2018-01-03 15:54:19 +00:00
|
|
|
import './Results.css'
|
|
|
|
import { encodeRuleName } from 'Engine/rules'
|
|
|
|
import RuleValueVignette from './rule/RuleValueVignette'
|
|
|
|
import ProgressTip from 'Components/ProgressTip'
|
2017-05-18 10:07:17 +00:00
|
|
|
|
|
|
|
@withRouter
|
2017-12-05 11:58:24 +00:00
|
|
|
@connect(state => ({
|
2018-01-03 15:54:19 +00:00
|
|
|
analysis: state.analysis,
|
|
|
|
targetName: state.targetName,
|
|
|
|
conversationStarted: !R.isEmpty(state.form),
|
|
|
|
conversationFirstAnswer: R.path(['form', 'conversation', 'values'])(state),
|
|
|
|
situationGate: state.situationGate,
|
|
|
|
done: state.done
|
2017-12-05 11:58:24 +00:00
|
|
|
}))
|
2017-01-10 18:22:44 +00:00
|
|
|
export default class Results extends Component {
|
2018-01-03 15:54:19 +00:00
|
|
|
render() {
|
|
|
|
let {
|
|
|
|
analysis,
|
|
|
|
targetName,
|
|
|
|
conversationStarted,
|
|
|
|
conversationFirstAnswer,
|
|
|
|
location,
|
|
|
|
done
|
|
|
|
} = this.props
|
2017-08-21 13:39:54 +00:00
|
|
|
|
2018-01-03 15:54:19 +00:00
|
|
|
if (!analysis) return null
|
2017-05-18 10:07:17 +00:00
|
|
|
|
2018-01-03 15:54:19 +00:00
|
|
|
let { targets } = analysis
|
2017-11-07 18:46:40 +00:00
|
|
|
|
2018-01-03 15:54:19 +00:00
|
|
|
let onRulePage = R.contains('/regle/')(location.pathname)
|
|
|
|
return (
|
|
|
|
<div id="resultsZone">
|
|
|
|
<section id="results">
|
|
|
|
<ProgressTip />
|
|
|
|
<div id="resultsContent">
|
|
|
|
<Link className="edit" to="/">
|
|
|
|
<i className="fa fa-pencil-square-o" aria-hidden="true" />
|
|
|
|
{' '}
|
|
|
|
<span>Changer d'objectif</span>
|
|
|
|
</Link>
|
|
|
|
<ul>
|
|
|
|
{targets.map(rule => (
|
|
|
|
<li key={rule.nom}>
|
|
|
|
<RuleValueVignette
|
|
|
|
{...rule}
|
|
|
|
conversationStarted={conversationStarted}
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<h3
|
|
|
|
className="scrollIndication down"
|
|
|
|
style={{ opacity: done ? 1 : 0 }}
|
|
|
|
>
|
|
|
|
<i className="fa fa-long-arrow-down" aria-hidden="true" />{' '}
|
|
|
|
Comprendre mes résultats
|
|
|
|
</h3>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
2017-01-10 18:22:44 +00:00
|
|
|
}
|