 React = require 'react'
 AutoSave = require '../../components/auto-save'
 handleInputChange = require '../../lib/handle-input-change'
-PromiseRenderer = require '../../components/promise-renderer'
 apiClient = require 'panoptes-client/lib/api-client'
 ChangeListener = require '../../components/change-listener'
 Papa = require 'papaparse'

        @setState pageCount: newPageCount

    gettingSubjects = gettingSetMemberSubjects.get 'subject'

    <div>
      <PromiseRenderer promise={gettingSubjects} then={(subjects) =>
        <SubjectSetListingTable subjects={subjects} onPreview={@previewSubject} onRemove={@removeSubject} />
      } />
      <nav className="pagination">
        Page <select value={@state.page} disabled={@state.pageCount < 2 or isNaN @state.pageCount} onChange={(e) => @setState page: e.target.value}>
          {if isNaN @state.pageCount
            <option>?</option>
          else
            for p in [1..@state.pageCount]
              <option key={p} value={p}>{p}</option>}
        </select> of {@state.pageCount || '?'}
      </nav>
    </div>

  previewSubject: (subject) ->
    alert <div className="content-container subject-preview">

    if nextProps.params.subjectSetID isnt @props.params.subjectSetID
      @setSubjectSet(nextProps.params.subjectSetID)

  componentWillMount: ->
    @setSubjectSet(@props.params.subjectSetID)

  setSubjectSet: (subjectSetId) ->
    subject_set = apiClient.type('subject_sets').get subjectSetId
