import { goBackToSimulation } from 'Actions/actions' import { ScrollToTop } from 'Components/utils/Scroll' import { decodeRuleName, findRuleByDottedName } from 'Engine/rules.js' import { compose } from 'ramda' import React from 'react' import { Trans } from 'react-i18next' import { connect } from 'react-redux' import { Redirect } from 'react-router-dom' import { flatRulesSelector, noUserInputSelector, situationBranchNameSelector } from 'Selectors/analyseSelectors' import Rule from './rule/Rule' import './RulePage.css' import SearchButton from './SearchButton' export default compose( connect(state => ({ valuesToShow: !noUserInputSelector(state), flatRules: flatRulesSelector(state), brancheName: situationBranchNameSelector(state) })) )(function RulePage({ flatRules, match, valuesToShow, brancheName }) { let name = match ?.params ?.name, decodedRuleName = decodeRuleName(name) const renderRule = dottedName => { return (
{valuesToShow ? : } {brancheName && {brancheName}}
) } if (!findRuleByDottedName(flatRules, decodedRuleName)) return return renderRule(decodedRuleName) }) const BackToSimulation = compose( connect( null, { goBackToSimulation } ) )( // Triggers rerender when the language changes function BackToSimulation({ goBackToSimulation }) { return ( ) } )