 UserSearch = require '../components/user-search'
 apiClient = require 'panoptes-client/lib/api-client'
 CollectionRole = require '../lib/collection-role'
-PromiseRenderer = require '../components/promise-renderer'
 
 ID_PREFIX = 'COLLECTION_COLLABORATORS_PAGE_'
 

    error: null
    owner: null
    roleSets: []

  componentDidMount: ->
    @update()

  update: (callback = ->) ->

    @update()

  render: ->
    if @state.hasSettingsRole
      { roleSets, owner } = @state

      <div className="collection-settings-tab">
        {if @state.error?
          <p className="form-help error">{@state.error.toString()}</p>}

        {if roleSets.length is 1
          <div className="helpful-tip">None yet, add some with the form below.</div>}

        {if owner and roleSets.length > 1
          <div>
            {for roleSet in roleSets
              continue if owner.id is roleSet.links.owner.id
              <RoleRow key={roleSet.id} roleSet={roleSet} onRemove={@handleCollaboratorChange} />}
          </div>}

        <br />
        <hr />
        <br />

        <div className="form-label">Add a collaborator</div>
        <RoleCreator collection={@props.collection} onAdd={@handleCollaboratorChange} />
      </div>
    else
      <div className="collection-settings-tab">
        <p>Not allowed to edit this collection</p>
      </div>
