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