<commit_before>import React, { PropTypes } from 'react'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
import { Link } from 'react-router'
import { defineMessages, FormattedMessage } from 'react-intl'
import SearchFilter from './SearchFilter'

class SearchFilters extends React.Component {
  constructor (props) {
    super(props)
    this.handleFiltersOpenClick = this.handleFiltersOpenClick.bind(this)
  }

  renderEmpty () {
    return <div data-automation-id="empty" />
  }

  handleFiltersOpenClick (event) {
    event.preventDefault()
    event.stopPropagation()
    this.props.toggleAllFiltersVisibility()
  }

  render () {
    const groupedFilters = {}
    const buttonClass = (this.props.locationQuery.hideFilters === null) ? 'filters-hidden' : 'filters-visible'
    if (this.props.locationQuery.query && this.props.filters) {
      this.props.filters.forEach(filter => {
        const aggregation = filter.id.split('_')[0]
        groupedFilters[ aggregation ] = groupedFilters[ aggregation ] || []
        groupedFilters[ aggregation ].push(filter)
      })

      return (
        <ReactCSSTransitionGroup
        transitionName="fade-in"
        transitionAppear
        transitionEnterTimeout={500}<commit_msg>DEICH-292 Patron client - Hide filters ad default on mobile and show them on desktop<commit_after>import React, { PropTypes } from 'react'
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
import { Link } from 'react-router'
import { defineMessages, FormattedMessage } from 'react-intl'
import SearchFilter from './SearchFilter'

class SearchFilters extends React.Component {
  constructor (props) {
    super(props)
    this.handleFiltersOpenClick = this.handleFiltersOpenClick.bind(this)
    this.toggleFilterVisibility = this.toggleFilterVisibility.bind(this)
  }

  componentDidMount () {
    window.addEventListener('resize', this.toggleFilterVisibility)
    this.toggleFilterVisibility()
  }

  renderEmpty () {
    return <div data-automation-id="empty" />
  }

  handleFiltersOpenClick (event) {
    event.preventDefault()
    event.stopPropagation()
    this.props.toggleAllFiltersVisibility()
  }

  toggleFilterVisibility () {
    if (window.innerWidth < 668) {                           // If screen size is mobile
      if (this.props.locationQuery.hideFilters !== null) { // And filters are visible
        this.props.toggleAllFiltersVisibility()             // Hide the filters
      }
    } else {                                                // If screen size is tatblet or above
      if (this.props.locationQuery.hideFilters === null) { // And filters are hidden
        this.props.toggleAllFiltersVisibility()             // Show the filters
      }
    }
  }

  render () {
    const groupedFilters = {}
    const buttonClass = (this.props.locationQuery.hideFilters === null) ? 'filters-hidden' : 'filters-visible'

    if (this.props.locationQuery.query && this.props.filters) {
      this.props.filters.forEach(filter => {
        const aggregation = filter.id.split('_')[0]
        groupedFilters[ aggregation ] = groupedFilters[ aggregation ] || []
        groupedFilters[ aggregation ].push(filter)
      })

      return (
        <ReactCSSTransitionGroup
        transitionName="fade-in"
        transitionAppear
        transitionEnterTimeout={500}
{'fraction_non_alphanumeric': 0.10743061772605192, 'fraction_numerical': 0.0041778573560131305, 'mean_word_length': 3.0729040097205345, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4370263', 'n_tokens_mistral': 927, 'n_tokens_neox': 915, 'n_words': 193}