<commit_before>import React from 'react'

import LeftNav from 'material-ui/lib/left-nav'
import AppBar from 'material-ui/lib/app-bar'
import List from 'material-ui/lib/lists/list';
import ListItem from 'material-ui/lib/lists/list-item'
import Divider from 'material-ui/lib/divider'
import ArrowDropRight from 'material-ui/lib/svg-icons/navigation-arrow-drop-right'
import RadioButton from 'material-ui/lib/radio-button'

import Types from './types'


export default class AnnotateBar extends React.Component {
  render() {
    console.log("AnnotateBar.render", this.props.currentAnnotation)
    let open = !!this.props.currentAnnotation
    let title = this.props.currentAnnotation &&
      this.props.currentAnnotation.type === 'new' ?
      "Annotieren" : "Ändern"
    return (
      <LeftNav open={open} openRight={true} width={240}>
        <AppBar title={title} showMenuIconButton={false}/>
        <TypesMenu
            value={this.props.currentAnnotation && this.props.currentAnnotation.type}
            onType={type => this.onType(type)}
            />
      </LeftNav>
    )
  }

  onType(type) {
    this.props.onType(type)
  }
}

class TypesMenu extends React.Component {
  constructor(props) {
    super(props)
  }
  
  render() {
    console.log("TypesMenu.render", this.props.value)
    return (
      <div>
        {Types.map((category, i) => (
          <List subheader={category.title} key={i}>
            {category.types.map((type, j) => (
              <ListItem key={j} style={{ backgroundColor: `rgb(${type.rgb})` }}>
                <RadioButton label={type.title}
                    name="type" value={type.title}
                    checked={this.props.value == type.title}
                    onCheck={ev => this.onCheck(ev)}
                    />
              </ListItem>
            ))}
          </List>
        ))}
      </div>
    )
  }

  onCheck(ev) {
    let value = ev.target.value
    this.props.onType(value)
  }
}<commit_msg>AnnotateBar: remove one level of indirection<commit_after>import React from 'react'

import LeftNav from 'material-ui/lib/left-nav'
import AppBar from 'material-ui/lib/app-bar'
import List from 'material-ui/lib/lists/list';
import ListItem from 'material-ui/lib/lists/list-item'
import Divider from 'material-ui/lib/divider'
import ArrowDropRight from 'material-ui/lib/svg-icons/navigation-arrow-drop-right'
import RadioButton from 'material-ui/lib/radio-button'

import Types from './types'


export default class AnnotateBar extends React.Component {
  render() {
    console.log("AnnotateBar.render", this.props.currentAnnotation)
    let open = !!this.props.currentAnnotation
    let title = this.props.currentAnnotation &&
      this.props.currentAnnotation.type === 'new' ?
      "Annotieren" : "Ändern"
    return (
      <LeftNav open={open} openRight={true} width={240}>
        <AppBar title={title} showMenuIconButton={false}/>
        <TypesMenu
            value={this.props.currentAnnotation && this.props.currentAnnotation.type}
            onType={this.props.onType}
            />
      </LeftNav>
    )
  }
}

class TypesMenu extends React.Component {
  constructor(props) {
    super(props)
  }
  
  render() {
    console.log("TypesMenu.render", this.props.value)
    return (
      <div>
        {Types.map((category, i) => (
          <List subheader={category.title} key={i}>
            {category.types.map((type, j) => (
              <ListItem key={j} style={{ backgroundColor: `rgb(${type.rgb})` }}>
                <RadioButton label={type.title}
                    name="type" value={type.title}
                    checked={this.props.value == type.title}
                    onCheck={ev => this.onCheck(ev)}
                    />
              </ListItem>
            ))}
          </List>
        ))}
      </div>
    )
  }

  onCheck(ev) {
    let value = ev.target.value
    if (this.props.onType) {
      this.props.onType(value)
    }
  }
}
{'fraction_non_alphanumeric': 0.1403953370501774, 'fraction_numerical': 0.0015205271160669033, 'mean_word_length': 2.3967297762478483, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 32, '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': '2182459', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1196, 'n_words': 224}