 React = require 'react'
 WorkflowToggle = require '../../components/workflow-toggle'
-PromiseRenderer = require '../../components/promise-renderer'
 SetToggle = require '../../lib/set-toggle'
 Dialog = require 'modal-form/dialog'
 getWorkflowsInOrder = require '../../lib/get-workflows-in-order'

      <hr/>

      <p className="form-label">Workflow Settings</p>
      <PromiseRenderer promise={getWorkflowsInOrder @props.project, fields: 'display_name,active'}>{(workflows) =>
        if workflows.length is 0
          <div className="workflow-status-list">No workflows found</div>
        else
          <div className="workflow-status-list">
            <ul>
            {workflows.map (workflow) =>
              <li key={workflow.id}>
                <WorkflowToggle workflow={workflow} project={@props.project} field="active" />
              </li>}
            </ul>
          </div>
      }</PromiseRenderer>
      <p className="form-help">In a live project active workflows are available to volunteers and cannot be edited. Inactive workflows can be edited if a project is live or in development.</p>
      <p className="form-help">On a live project, if you want to switch which subjects sets are associated with an active workflow: set the workflow to inactive, next change which subject sets are linked in the Workflow Section within the Project Builder, then return the workflow to active.</p>
    </div>

      private: false
      beta_requested: false
      launch_requested: false
    workflows: null

  mixins: [SetToggle]

  setterProperty: 'project'

  componentDidMount: ->
    getWorkflowsInOrder(@props.project, fields: 'display_name,active')
      .then((workflows) =>
        @setState({ workflows })
      )

  isReviewable: ->
    not @props.project.private and
