⚙️ Plus besoin de clearInjections
parent
0d2b4a2dcb
commit
240780fd03
|
@ -12,7 +12,6 @@ let RuleWithoutFormula = () =>
|
|||
doit donc être renseignée directement.
|
||||
</p>
|
||||
|
||||
|
||||
@AttachDictionary(knownMecanisms)
|
||||
export default class Algorithm extends React.Component {
|
||||
state = {
|
||||
|
|
|
@ -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 ?
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue