⚙️ Plus besoin de clearInjections

pull/61/head
Laurent Bossavit 2017-09-26 11:32:13 +02:00
parent 0d2b4a2dcb
commit 240780fd03
3 changed files with 3 additions and 5 deletions

View File

@ -12,7 +12,6 @@ let RuleWithoutFormula = () =>
doit donc être renseignée directement.
</p>
@AttachDictionary(knownMecanisms)
export default class Algorithm extends React.Component {
state = {

View File

@ -42,7 +42,7 @@ export default class Examples extends Component {
render() {
let examples = this.runExamples(),
focusedExample = R.path(['focusedExample', 'nom'])(this.props),
{clearInjection, inject, situationExists , showValues} = this.props
{inject, situationExists , showValues} = this.props
return (
<div id="examples">
@ -53,7 +53,7 @@ export default class Examples extends Component {
: <ul>{
examples.map(({nom, ok, rule, 'valeur attendue': expected}) =>
<li key={nom} className={classNames("example", {ok, selected: focusedExample == nom})}
onClick={() => focusedExample == nom ? clearInjection() : inject({nom, ok, rule})}
onClick={() => focusedExample == nom ? false : inject({nom, ok, rule})}
>
<span> {
ok ?

View File

@ -105,13 +105,12 @@ export default class Rule extends Component {
</div>
</section>
<section id="rule-calc">
<Algorithm {...{traversedRule: R.path(['example', 'rule'])(this.state) || this.rule, showValues: this.state.showValues}}/>
<Algorithm {...{traversedRule: R.path(['example', 'rule'])(this.state) || this.rule, showValues: situationExists || this.state.example != null}}/>
<Examples
situationExists={situationExists}
rule={this.rule}
focusedExample={this.state.example}
showValues={this.state.showValues}
clearInjection={() => this.setState({example: null, showValues: false})}
inject={example => this.setState({example, showValues: true})}/>
</section>
</div>