+#= require rglossa/react/utils
 #= require ./main_area_top
 #= require ./main_area_bottom
 

      method: 'POST'
      data: JSON.stringify
        queries: [query]
        max_hits: @state.maxHits
      dataType: 'json'
      contentType: 'application/json'
    ).then (res) =>

    @setState(query: query)

  handleMaxHitsChanged: (maxHits) ->
    newState = maxHits: maxHits
    @setState(newState)
    @handleSearch(newState)

  showCorpusHome: ->
    alert 'showCorpusHome'

  handleSearch: (newState = {}) ->
    state = rglossaUtils.merge(@state, newState)
    {store, statechart, corpus} = @props
    searchEngine = corpus.search_engine ?= 'cwb'
    url = "search_engines/#{searchEngine}_searches"
    query =
      query: state.query
      corpusShortName: corpus.short_name

    $.ajax(
