import { setExample } from 'Actions/actions'
import { ScrollToTop } from 'Components/utils/Scroll'
import { encodeRuleName } from 'Engine/rules'
import {
decodeRuleName,
findRuleByDottedName,
findRulesByName
} from 'Engine/rules.js'
import { compose, head, path } from 'ramda'
import React, { Component } from 'react'
import { Trans, translate } from 'react-i18next'
import { connect } from 'react-redux'
import { withRouter } from 'react-router'
import { Link, Redirect } from 'react-router-dom'
import {
flatRulesSelector,
noUserInputSelector
} from 'Selectors/analyseSelectors'
import Namespace from './rule/Namespace'
import Rule from './rule/Rule'
import './RulePage.css'
import SearchButton from './SearchButton'
@connect(state => ({
themeColours: state.themeColours,
valuesToShow: !noUserInputSelector(state),
flatRules: flatRulesSelector(state)
}))
@translate()
class RulePage extends Component {
render() {
let { flatRules } = this.props,
name = path(['match', 'params', 'name'], this.props),
decodedRuleName = decodeRuleName(name)
if (decodedRuleName.includes(' . ')) {
if (!findRuleByDottedName(flatRules, decodedRuleName))
return