<commit_before>/**
 * Component wrapping function panels
 */

import React from 'react'
import FunctionSettings from './FunctionSettings'
import FunctionSearch from './FunctionSearch'
import FunctionFilter from './FunctionFilter'

import Toggleable from './Toggleable'

export default class FunctionsSidebar {
  constructor (props) {
    super.constructor(props)
  }

  render () {

    let functionToRender

    if (this.props.opened == 'settings') {
      functionToRender = (
        <FunctionSettings
          ref="functionSettings"
          onSettingChange={this.props.onSettingChange}
          onLanguageChange={this.props.onRefreshNeed}
          options={this.props.options}
        />
      )
    }
    if (this.props.opened == 'search') {
      functionToRender = (
        <FunctionSearch
          ref="functionSearch"
          onSearch={this.props.onSearch}
          searchResults={this.props.searchResults}
          onViewChange={this.props.onViewChange}
        />
      )
    }
    if (this.props.opened == 'filter') {
      functionToRender = (
        <FunctionFilter
          ref="functionFilter"
          displayFilter={this.props.displayFilter}
          onFilterChange={this.props.onFilterChange}
        />
      )
    }

    const className = `functions-sidebar ${this.props.opened !== null ? '' : 'hide'}`

    return (
      <div className={className}>
        <div className="wrap">
          {functionToRender}
        </div>
      </div>
    )
  }
}<commit_msg>Add propTypes for FunctionsSidebar<commit_after>/**
 * Component wrapping function panels
 */

import React, { PropTypes } from 'react'

import { options as optionsType } from '../types'
import FunctionSettings from './FunctionSettings'
import FunctionSearch from './FunctionSearch'
import FunctionFilter from './FunctionFilter'

const propTypes = {
  opened: PropTypes.oneOf(['settings', 'search', 'filter']),
  onSettingsChange: PropTypes.func,
  onRefreshNeed: PropTypes.func,
  options: PropTypes.shape(optionsType),
  onSearch: PropTypes.func,
  searchResults: PropTypes.array, // FIXME: shared type
  onViewChange: PropTypes.func,
  displayFilter: PropTypes.objectOf(PropTypes.bool), // FIXME: shared type
  onFilterChange: PropTypes.func,
}

class FunctionsSidebar {

  render () {

    let functionToRender

    if (this.props.opened == 'settings') {
      functionToRender = (
        <FunctionSettings
          ref="functionSettings"
          onSettingChange={this.props.onSettingChange}
          onLanguageChange={this.props.onRefreshNeed}
          options={this.props.options}
        />
      )
    }
    if (this.props.opened == 'search') {
      functionToRender = (
        <FunctionSearch
          ref="functionSearch"
          onSearch={this.props.onSearch}
          searchResults={this.props.searchResults}
          onViewChange={this.props.onViewChange}
        />
      )
    }
    if (this.props.opened == 'filter') {
      functionToRender = (
        <FunctionFilter
          ref="functionFilter"
          displayFilter={this.props.displayFilter}
          onFilterChange={this.props.onFilterChange}
        />
      )
    }

    const className = `functions-sidebar ${this.props.opened !== null ? '' : 'hide'}`

    return (
      <div className={className}>
        <div className="wrap">
          {functionToRender}
        </div>
      </div>
    )
  }
}

FunctionsSidebar.propTypes = propTypes

export default FunctionsSidebar
{'fraction_non_alphanumeric': 0.11662817551963048, 'fraction_numerical': 0.0, 'mean_word_length': 2.5981308411214954, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6256353', 'n_tokens_mistral': 952, 'n_tokens_neox': 938, 'n_words': 184}