La barre de résultats apparaît directement, au-dessus des questions
parent
0bcedd7028
commit
647d75ba13
|
@ -58,7 +58,7 @@
|
|||
|
||||
inversions possibles:
|
||||
- salaire net
|
||||
- salaire super brut
|
||||
- super brut
|
||||
- coût du travail
|
||||
|
||||
références:
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
#results {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 2.5%;
|
||||
width: 90%;
|
||||
max-width: 45em;
|
||||
margin: 0 auto;
|
||||
|
@ -11,18 +8,7 @@
|
|||
color: white;
|
||||
font-size: 120%;
|
||||
box-shadow: 0px 0px 20px 2px rgba(0, 0, 0, 0.25);
|
||||
|
||||
opacity: 0;
|
||||
transform: translate(-50%, 12em);
|
||||
transition: transform .5s;
|
||||
transition-delay: .3s;
|
||||
transition-timing-function: cubic-bezier(0, 1.01, 0.24, 1)
|
||||
}
|
||||
#results.show {
|
||||
transform: translate(-50%, 0);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
#results-actions {
|
||||
background: #333350;
|
||||
|
|
|
@ -21,17 +21,12 @@ import RuleValueVignette from './rule/RuleValueVignette'
|
|||
})
|
||||
)
|
||||
export default class Results extends Component {
|
||||
componentDidMount(){
|
||||
setTimeout(() =>
|
||||
this.el && this.props.setElementHeight(this.el.offsetHeight)
|
||||
, 1)
|
||||
}
|
||||
render() {
|
||||
let {
|
||||
analysis,
|
||||
targetName,
|
||||
conversationStarted,
|
||||
conversationFirstAnswer: showResults,
|
||||
conversationFirstAnswer,
|
||||
location
|
||||
} = this.props
|
||||
|
||||
|
@ -43,7 +38,7 @@ export default class Results extends Component {
|
|||
|
||||
let onRulePage = R.contains('/regle/')(location.pathname)
|
||||
return (
|
||||
<section ref={el => this.el = el} id="results" className={classNames({show: showResults})}>
|
||||
<section ref={el => this.el = el} id="results">
|
||||
{onRulePage && conversationStarted ?
|
||||
<div id ="results-actions">
|
||||
<Link id="toSimulation" to={'/simu/' + encodeRuleName(targetName)}>
|
||||
|
|
|
@ -10,12 +10,13 @@ import { START_CONVERSATION } from '../actions'
|
|||
import { rules, findRuleByName, decodeRuleName } from 'Engine/rules'
|
||||
import './conversation/conversation.css'
|
||||
import './Simulateur.css'
|
||||
import { capitalise0 } from '../utils'
|
||||
import Conversation from './conversation/Conversation'
|
||||
import { makeQuestion } from 'Engine/generateQuestions'
|
||||
|
||||
import ReactPiwik from './Tracker'
|
||||
|
||||
import Results from 'Components/Results'
|
||||
|
||||
@withRouter
|
||||
@connect(
|
||||
state => ({
|
||||
|
@ -26,8 +27,8 @@ import ReactPiwik from './Tracker'
|
|||
situationGate: state.situationGate
|
||||
}),
|
||||
dispatch => ({
|
||||
startConversation: (targetNames, firstInput) =>
|
||||
dispatch({ type: START_CONVERSATION, targetNames, firstInput}),
|
||||
startConversation: targetNames =>
|
||||
dispatch({ type: START_CONVERSATION, targetNames}),
|
||||
resetForm: () => dispatch(reset('conversation'))
|
||||
})
|
||||
)
|
||||
|
@ -36,18 +37,16 @@ export default class extends Component {
|
|||
started: false
|
||||
}
|
||||
componentWillMount() {
|
||||
let { match: { params: { targets: encodedTargets, firstInput: encodedFirstInput } } } = this.props,
|
||||
targetNames = encodedTargets.split('+').map(decodeRuleName),
|
||||
existingConversation = this.props.foldedSteps.length > 0
|
||||
let { match: { params: { targets: encodedTargets} } } = this.props,
|
||||
targetNames = encodedTargets.split('+').map(decodeRuleName)
|
||||
|
||||
this.targetNames = targetNames
|
||||
this.targetRules = targetNames.map(name => findRuleByName(rules, name))
|
||||
this.firstInput = findRuleByName(rules, decodeRuleName(encodedFirstInput)).dottedName
|
||||
|
||||
// C'est ici que la génération du formulaire, et donc la traversée des variables commence
|
||||
// if (!existingConversation)
|
||||
//TODO
|
||||
this.props.startConversation(targetNames, this.firstInput)
|
||||
this.props.startConversation(targetNames)
|
||||
}
|
||||
render() {
|
||||
//TODO
|
||||
|
@ -64,7 +63,7 @@ export default class extends Component {
|
|||
reinitalise = () => {
|
||||
ReactPiwik.push(['trackEvent', 'restart', ''])
|
||||
this.props.resetForm(this.name)
|
||||
this.props.startConversation(this.targets, this.firstInput)
|
||||
this.props.startConversation(this.targets)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -72,8 +71,8 @@ export default class extends Component {
|
|||
<Helmet>
|
||||
<title>Titre à mettre</title>
|
||||
</Helmet>
|
||||
<h1>Titre et sous titres à mettre TODO</h1>
|
||||
|
||||
<h1>Titre et sous titres à mettre</h1>
|
||||
<Results />
|
||||
<Conversation
|
||||
{...{
|
||||
reinitalise,
|
||||
|
|
|
@ -3,13 +3,6 @@
|
|||
.RuleValueVignette li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.RuleValueVignette .rule-type {
|
||||
color: white;
|
||||
border: none;
|
||||
line-height: 2em;
|
||||
font-weight: 600;
|
||||
margin: .6em 0 .1em;
|
||||
}
|
||||
.RuleValueVignette .rule-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
@ -29,7 +29,6 @@ export default ({
|
|||
})}
|
||||
>
|
||||
<Link to={"/regle/" + encodeRuleName(name)}>
|
||||
<div className="rule-type">{type}</div>
|
||||
<div className="rule-box">
|
||||
<span className="rule-name">{titre || capitalise0(name)}</span>
|
||||
<RuleValue
|
||||
|
|
|
@ -3,68 +3,62 @@ import './Layout.css'
|
|||
import './reset.css'
|
||||
import './ribbon.css'
|
||||
|
||||
import {Link, Route, Router, Switch, Redirect} from 'react-router-dom'
|
||||
import { Link, Route, Router, Switch, Redirect } from 'react-router-dom'
|
||||
|
||||
import Home from 'Components/Home'
|
||||
import Rule from 'Components/rule/Rule'
|
||||
import Route404 from 'Components/Route404'
|
||||
import Contact from 'Components/Contact'
|
||||
import Simulateur from 'Components/Simulateur'
|
||||
import Results from 'Components/Results'
|
||||
import RulesList from "Components/RulesList"
|
||||
import RulesList from 'Components/RulesList'
|
||||
|
||||
import ReactPiwik from 'Components/Tracker';
|
||||
import ReactPiwik from 'Components/Tracker'
|
||||
import createHistory from 'history/createBrowserHistory'
|
||||
|
||||
const piwik = new ReactPiwik({
|
||||
url: 'stats.data.gouv.fr',
|
||||
siteId: 39,
|
||||
trackErrors: true,
|
||||
trackErrors: true
|
||||
})
|
||||
|
||||
export default class Layout extends Component {
|
||||
history = createHistory()
|
||||
state = {
|
||||
resultsHeight: 0
|
||||
}
|
||||
render() {
|
||||
let displayWarning = ["/simu/", "/regle/", "/regles"].find(
|
||||
let displayWarning = ['/simu/', '/regle/', '/regles'].find(
|
||||
t => window.location.href.toString().indexOf(t) > -1
|
||||
)
|
||||
|
||||
// track the initial pageview
|
||||
ReactPiwik.push(["trackPageView"])
|
||||
ReactPiwik.push(['trackPageView'])
|
||||
|
||||
return (
|
||||
<Router history={piwik.connectToHistory(this.history)}>
|
||||
<div id="main">
|
||||
<div>
|
||||
<div id="header">
|
||||
|
||||
{ displayWarning &&
|
||||
<span id="ribbon">
|
||||
<Link to="/contact"><em>version beta</em> <i className="fa fa-flask" aria-hidden="true"></i></Link>
|
||||
</span>
|
||||
}
|
||||
{
|
||||
// this.props.location.pathname != '/' &&
|
||||
// <Link to="/">
|
||||
// <img id="site-logo" src={require('../images/logo.png')} />
|
||||
// </Link>
|
||||
}
|
||||
</div>
|
||||
<Switch>
|
||||
<Route exact path="/" component={Home} />
|
||||
<Route path="/contact" component={Contact} />
|
||||
<Route path="/regle/:name" component={Rule} />
|
||||
<Route path="/regles" component={RulesList} />
|
||||
<Route path="/simu/:targets" component={Simulateur} />
|
||||
<Redirect from="/simu/:name/intro" to="/simu/:name" />
|
||||
<Route component={Route404} />
|
||||
</Switch>
|
||||
<div id="header">
|
||||
{displayWarning && (
|
||||
<span id="ribbon">
|
||||
<Link to="/contact">
|
||||
<em>version beta</em>{' '}
|
||||
<i className="fa fa-flask" aria-hidden="true" />
|
||||
</Link>
|
||||
</span>
|
||||
)}
|
||||
{
|
||||
// this.props.location.pathname != '/' &&
|
||||
// <Link to="/">
|
||||
// <img id="site-logo" src={require('../images/logo.png')} />
|
||||
// </Link>
|
||||
}
|
||||
</div>
|
||||
<div id="antiOverlap" style={{height: this.state.resultsHeight + 'px'}}/>
|
||||
<Results setElementHeight={resultsHeight => this.setState({resultsHeight})}/>
|
||||
<Switch>
|
||||
<Route exact path="/" component={Home} />
|
||||
<Route path="/contact" component={Contact} />
|
||||
<Route path="/regle/:name" component={Rule} />
|
||||
<Route path="/regles" component={RulesList} />
|
||||
<Route path="/simu/:targets" component={Simulateur} />
|
||||
<Redirect from="/simu/:name/intro" to="/simu/:name" />
|
||||
<Route component={Route404} />
|
||||
</Switch>
|
||||
</div>
|
||||
</Router>
|
||||
)
|
||||
|
|
|
@ -63,11 +63,10 @@ export let reduceSteps = (tracker, flatRules, answerSource) => (state, action) =
|
|||
|
||||
if (action.type == START_CONVERSATION) {
|
||||
let next = nextSteps(situationGate, flatRules, newState.analysis)
|
||||
console.log('next', action.firstInput)
|
||||
return {
|
||||
...newState,
|
||||
foldedSteps: [],
|
||||
currentQuestion: action.firstInput || R.head(next)
|
||||
currentQuestion: R.head(next)
|
||||
}
|
||||
}
|
||||
if (action.type == STEP_ACTION && action.name == 'fold') {
|
||||
|
|
Loading…
Reference in New Issue