Suppression des ennuyants point out objectives
Ils ne sont plus affichés dans l'interfacepull/55/head
parent
9f880f4afe
commit
beceb42654
|
@ -30,5 +30,3 @@ export function changeThemeColour(colour) {return {type: CHANGE_THEME_COLOUR, co
|
|||
|
||||
|
||||
export const EXPLAIN_VARIABLE = 'EXPLAIN_VARIABLE'
|
||||
|
||||
export const POINT_OUT_OBJECTIVES = 'POINT_OUT_OBJECTIVES'
|
||||
|
|
|
@ -135,23 +135,6 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#results li:not(.pointedOut):hover .rule-box {
|
||||
background: #ddd;
|
||||
}
|
||||
#results li.irrelevant .rule-box {
|
||||
background: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
|
||||
#results li.pointedOut:not(.irrelevant) .rule-name {
|
||||
color: #4A89DC;
|
||||
}
|
||||
#results li.pointedOut .rule-type {
|
||||
color: #4A89DC;
|
||||
}
|
||||
|
||||
#results li.pointedOut .rule-box {
|
||||
border-bottom: .8em solid #4A89DC;
|
||||
}
|
||||
#results li.number p {
|
||||
color: #4A89DC;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -18,7 +18,6 @@ let humanFigure = decimalDigits => value => fmt(value.toFixed(decimalDigits))
|
|||
@withRouter
|
||||
@connect(
|
||||
state => ({
|
||||
pointedOutObjectives: state.pointedOutObjectives,
|
||||
analysedSituation: state.analysedSituation,
|
||||
conversationStarted: !R.isEmpty(state.form),
|
||||
conversationFirstAnswer: R.path(['form', 'conversation', 'values'])(state),
|
||||
|
@ -29,7 +28,6 @@ export default class Results extends Component {
|
|||
render() {
|
||||
let {
|
||||
analysedSituation,
|
||||
pointedOutObjectives,
|
||||
conversationStarted,
|
||||
conversationFirstAnswer: showResults,
|
||||
situationGate,
|
||||
|
@ -70,12 +68,9 @@ export default class Results extends Component {
|
|||
unsatisfied = ruleValue == null,
|
||||
nonApplicableValue = nonApplicable ? nonApplicable.nodeValue : false,
|
||||
irrelevant = nonApplicableValue === true || formuleValue == 0,
|
||||
number = nonApplicableValue == false && formuleValue != null,
|
||||
pointedOut =
|
||||
pointedOutObjectives.find(objective => objective == dottedName)
|
||||
|| R.contains(encodeRuleName(name))(location.pathname)
|
||||
number = nonApplicableValue == false && formuleValue != null
|
||||
|
||||
;<li key={name} className={classNames({unsatisfied, irrelevant, number, pointedOut})}>
|
||||
;<li key={name} className={classNames({unsatisfied, irrelevant, number})}>
|
||||
|
||||
|
||||
<Link to={"/regle/" + encodeRuleName(name)} >
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||
import classNames from 'classnames'
|
||||
import { connect } from 'react-redux'
|
||||
import {Field, change} from 'redux-form'
|
||||
import {stepAction, POINT_OUT_OBJECTIVES} from '../../actions'
|
||||
import {stepAction} from '../../actions'
|
||||
import StepAnswer from './StepAnswer'
|
||||
import {capitalise0} from '../../utils'
|
||||
|
||||
|
@ -21,8 +21,7 @@ export var FormDecorator = formType => RenderField =>
|
|||
}),
|
||||
dispatch => ({
|
||||
stepAction: (name, step) => dispatch(stepAction(name, step)),
|
||||
setFormValue: (field, value) => dispatch(change('conversation', field, value)),
|
||||
pointOutObjectives: objectives => dispatch({type: POINT_OUT_OBJECTIVES, objectives})
|
||||
setFormValue: (field, value) => dispatch(change('conversation', field, value))
|
||||
})
|
||||
)
|
||||
class extends Component {
|
||||
|
@ -34,7 +33,6 @@ export var FormDecorator = formType => RenderField =>
|
|||
stepAction,
|
||||
themeColours,
|
||||
setFormValue,
|
||||
pointOutObjectives,
|
||||
/* Une étape déjà répondue est marquée 'folded'. Dans ce dernier cas, un résumé
|
||||
de la réponse est affiché */
|
||||
unfolded
|
||||
|
@ -83,8 +81,7 @@ export var FormDecorator = formType => RenderField =>
|
|||
return (
|
||||
<div
|
||||
className={classNames({step: unfolded}, formType)}
|
||||
onMouseEnter={() => null} //pointOutObjectives(objectives)}
|
||||
onMouseLeave={() => pointOutObjectives([])}>
|
||||
>
|
||||
{this.state.helpVisible && this.renderHelpBox(helpText)}
|
||||
<div style={{visibility: this.state.helpVisible ? 'hidden' : 'visible'}}>
|
||||
{this.renderHeader(unfolded, valueType, human, helpText, wideQuestion, subquestion)}
|
||||
|
@ -176,8 +173,5 @@ export var FormDecorator = formType => RenderField =>
|
|||
{helpComponent}
|
||||
</div>
|
||||
}
|
||||
componentWillUnmount(){
|
||||
this.props.pointOutObjectives([])
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import {reducer as formReducer, formValueSelector} from 'redux-form'
|
|||
import {rules, findRuleByName } from 'Engine/rules'
|
||||
import {buildNextSteps} from 'Engine/generateQuestions'
|
||||
import computeThemeColours from 'Components/themeColours'
|
||||
import { STEP_ACTION, START_CONVERSATION, EXPLAIN_VARIABLE, POINT_OUT_OBJECTIVES, CHANGE_THEME_COLOUR} from './actions'
|
||||
import { STEP_ACTION, START_CONVERSATION, EXPLAIN_VARIABLE, CHANGE_THEME_COLOUR} from './actions'
|
||||
|
||||
import {analyseTopDown} from 'Engine/traverse'
|
||||
|
||||
|
@ -32,8 +32,9 @@ export let reduceSteps = (state, action) => {
|
|||
|
||||
let sim = findRuleByName(flatRules, rootVariable),
|
||||
// Hard assumptions cannot be changed, they are used to specialise a simulator
|
||||
// before the user sees the first question
|
||||
hardAssumptions = R.pathOr({},['simulateur','hypothèses'],sim),
|
||||
// Soft assumptions are revealed after the simulation starts, and can be changed
|
||||
// Soft assumptions are revealed after the simulation ends, and can be changed
|
||||
softAssumptions = R.pathOr({},['simulateur','par défaut'],sim),
|
||||
intermediateSituation = assume(fromConversation, hardAssumptions),
|
||||
completeSituation = assume(intermediateSituation,softAssumptions)
|
||||
|
@ -59,7 +60,7 @@ export let reduceSteps = (state, action) => {
|
|||
unfoldedSteps = buildNextSteps(situationGate, flatRules, newState.analysedSituation)
|
||||
|
||||
// The simulation is "over" - except we can now fill in extra questions
|
||||
// where the answers were previously given reasonable assumptions
|
||||
// where the answers were previously given default reasonable assumptions
|
||||
if (unfoldedSteps.length == 0 && !R.isEmpty(softAssumptions)) {
|
||||
let newSituation = intermediateSituation(state),
|
||||
reanalyse = analyseTopDown(flatRules,rootVariable)(newSituation),
|
||||
|
@ -108,14 +109,6 @@ function explainedVariable(state = null, {type, variableName=null}) {
|
|||
}
|
||||
}
|
||||
|
||||
function pointedOutObjectives(state=[], {type, objectives}) {
|
||||
switch (type) {
|
||||
case POINT_OUT_OBJECTIVES:
|
||||
return objectives
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
export default reduceReducers(
|
||||
combineReducers({
|
||||
|
@ -136,9 +129,8 @@ export default reduceReducers(
|
|||
|
||||
themeColours,
|
||||
|
||||
explainedVariable,
|
||||
explainedVariable
|
||||
|
||||
pointedOutObjectives,
|
||||
}),
|
||||
// cross-cutting concerns because here `state` is the whole state tree
|
||||
reduceSteps
|
||||
|
|
Loading…
Reference in New Issue