Corrige la page blanche sur indemnité-kilométrique-vélo

pull/1291/head
Johan Girod 2020-12-09 15:49:47 +01:00
parent 46c0cf5da8
commit 546d0276c0
2 changed files with 14 additions and 15 deletions

View File

@ -2,6 +2,7 @@ import React, { useContext } from 'react'
import emoji from 'react-easy-emoji'
import { Link } from 'react-router-dom'
import Engine from '..'
import { InternalError } from '../error'
import { encodeRuleName, nameLeaf } from '../ruleUtils'
import { BasepathContext, EngineContext } from './contexts'
@ -41,18 +42,19 @@ export function RuleLink<Name extends string>({
// if (!ruleWithDedicatedDocumentationPage(rule)) {
// return <Explanation node={engine.evaluate(rule.dottedName).formule} />
// }
if (rule) {
return (
<Link to={newPath} {...props}>
{children || rule.title}{' '}
{displayIcon && rule.rawNode.icônes && (
<span>{emoji(rule.rawNode.icônes)} </span>
)}
</Link>
)
} else {
return <>{nameLeaf(dottedName)}</>
if (!rule) {
throw new InternalError({
dottedName,
})
}
return (
<Link to={newPath} {...props}>
{children || rule.title}{' '}
{displayIcon && rule.rawNode.icônes && (
<span>{emoji(rule.rawNode.icônes)} </span>
)}
</Link>
)
}
export function RuleLinkWithContext(

View File

@ -55,10 +55,7 @@ export default function Rule({ dottedName, engine, language }) {
<>
<h3>Parent non applicable</h3>
<p>
Cette règle est non applicable car{' '}
<RuleLinkWithContext
dottedName={(parent as ReferenceNode).dottedName as string}
/>{' '}
Cette règle est non applicable car <Explanation node={parent} />
est non applicable.
</p>
</>