<commit_before>
Header = React.createClass

  getInitialState: ->
    searchVal: @props.search

  handleSearchChange: (event) ->
    @setState
      searchVal: event.target.value

  setSearch: (val) ->
    @props.setSearch(val)

  handleSearchKeyDown: (event) ->
    if event.keyCode is 13 # Enter: commit search and close
      @setSearch(@state.searchVal)
      $("#searchDDToggle").dropdown("toggle")
    else if event.keyCode is 27 # Escape: clear search and commit
      @setState
        searchVal: ''
      @setSearch('')
      $("#searchDDToggle").dropdown("toggle")

  handleSearchToggle: (event) ->
    ReactDOM.findDOMNode(@refs.searchInput).focus()

  handleTasksKeyDown: (event) ->
    if event.keyCode is 70
      @props.selectTasks((tasks) =>
        _.first(tasks, 6)
      )
    else if event.keyCode is 76
      @props.selectTasks((tasks) =>
        _.last(tasks, 6)
      )
    else if event.keyCode is 79
      @props.selectTasks((tasks) =>
        _.first(_.filter(tasks, (t) =>
          t.taskId.instanceNo % 2 is 1
        ), 6)
      )
    else if event.keyCode is 69
      @props.selectTasks((tasks) =>
        _.first(_.filter(tasks, (t) =>
          t.taskId.instanceNo % 2 is 0
        ), 6)
      )
    else if 49 <= event.keyCode <= 57
      @props.selectTasks((tasks) =>
        _.filter(tasks, (t) =>
          t.taskId.instanceNo is parseInt(String.fromCharCode(event.keyCode))
        )
      )

  renderBreadcrumbs: ->
    segments = @props.path.split('/')
    return segments.map (s, i) =>
      path = segments.slice(0, i + 1).join('/')
      if i < segments.length - 1
        return (
          <li key={i}>
            {s}
          </li>
        )
      else
        return (
          <li key={i}>
            <strong>
                {s}
            </strong>
          </li>
        )

  renderTasksDropdown: -><commit_msg>Disable even shortcut for <2 instances<commit_after>
Header = React.createClass

  getInitialState: ->
    searchVal: @props.search

  handleSearchChange: (event) ->
    @setState
      searchVal: event.target.value

  setSearch: (val) ->
    @props.setSearch(val)

  handleSearchKeyDown: (event) ->
    if event.keyCode is 13 # Enter: commit search and close
      @setSearch(@state.searchVal)
      $("#searchDDToggle").dropdown("toggle")
    else if event.keyCode is 27 # Escape: clear search and commit
      @setState
        searchVal: ''
      @setSearch('')
      $("#searchDDToggle").dropdown("toggle")

  handleSearchToggle: (event) ->
    ReactDOM.findDOMNode(@refs.searchInput).focus()

  handleTasksKeyDown: (event) ->
    if event.keyCode is 70
      @props.selectTasks((tasks) =>
        _.first(tasks, 6)
      )
    else if event.keyCode is 76
      @props.selectTasks((tasks) =>
        _.last(tasks, 6)
      )
    else if event.keyCode is 79
      @props.selectTasks((tasks) =>
        _.first(_.filter(tasks, (t) =>
          t.taskId.instanceNo % 2 is 1
        ), 6)
      )
    else if event.keyCode is 69
      @props.selectTasks((tasks) =>
        if tasks.length <= 1
          return tasks
        _.first(_.filter(tasks, (t) =>
          t.taskId.instanceNo % 2 is 0
        ), 6)
      )
    else if 49 <= event.keyCode <= 57
      @props.selectTasks((tasks) =>
        _.filter(tasks, (t) =>
          t.taskId.instanceNo is parseInt(String.fromCharCode(event.keyCode))
        )
      )

  renderBreadcrumbs: ->
    segments = @props.path.split('/')
    return segments.map (s, i) =>
      path = segments.slice(0, i + 1).join('/')
      if i < segments.length - 1
        return (
          <li key={i}>
            {s}
          </li>
        )
      else
        return (
          <li key={i}>
            <strong>
                {s}
            </strong>
          </li>
        )

  renderTasksDropdown: ->
{'fraction_non_alphanumeric': 0.13847364280094415, 'fraction_numerical': 0.014686598478888015, 'mean_word_length': 1.9003802281368822, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 49, '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': '6609825', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1188, 'n_words': 264}