import React, { Component } from 'react'
// import {findRuleByName} from '../engine/rules.js'
import {analyseSituation} from '../engine/traverse'
import './Rule.css'
import JSONTree from 'react-json-tree'
import R from 'ramda'
import PageTypeIcon from './PageTypeIcon'
export default class Rule extends Component {
render() {
let {
name
} = this.props.params,
rule = analyseSituation(
v => ({'A': 'non', 'B': 'oui', 'C': 'oui', 'Z': 'non', 'X': 'non'}[v])
)[0]
return (
Pourquoi cette règle me concerne ? Comment est-elle calculée ?
{rule.type}
{name}
{ do {
let cond =
R.toPairs(rule).find(([,v]) => v.rulePropType == 'cond')
cond != null &&
Conditions de déclenchement
}}
{/*
{this.renderObject(rule)}
*/}
)
}
renderObject(o, rootKey){
return ''}
theme={theme}
hideRoot="true"
shouldExpandNode={() => true}
data={rootKey ? {[rootKey]: o} : o} />
}
renderReferences(rule) {
return (
rule['référence'] && {rule['référence']}
)
|| (
rule['références'] &&
{R.toPairs(rule['références']).map(
([name, link]) =>
-
{link.indexOf('legifrance.gouv') >= 0 &&
}
{name}
)}
)
}
}
let RuleProp = ({nodeValue, explanation, name}) =>
{name}
{
explanation.category == 'mecanism' &&
}
{
explanation.category == 'expression' &&
}
let Mecanism = ({nodeValue, name, explanation}) =>
{name}
{explanation.map(item => -
{item.category == 'expression' ?
:
}
)}
let Expression = ({nodeValue, expression}) =>
let NodeValue = ({data}) => do {
let valeur = data == null ? '?' : (
data ? 'oui' : 'non'
);
←
{valeur}
}
var theme = {
scheme: 'atelier forest',
author: 'bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)',
base00: '#1b1918',
base01: '#2c2421',
base02: '#68615e',
base03: '#766e6b',
base04: '#9c9491',
base05: '#a8a19f',
base06: '#e6e2e0',
base07: '#f1efee',
base08: '#f22c40',
base09: '#df5320',
base0A: '#d5911a',
base0B: '#5ab738',
base0C: '#00ad9c',
base0D: '#407ee7',
base0E: '#6666ea',
base0F: '#c33ff3'
}