 {Reactive} = require '../reactive'
 apiChannelName = 'exercise'
 
+WAIT_STATES = ['loading', 'saving']
+
 ExerciseBase = React.createClass
   displayName: 'ExerciseBase'
   getInitialState: ->


  getStepState: (props) ->
    props ?= @props
    {item} = props

    step: _.last(item)
    parts: item

  componentWillReceiveProps: (nextProps) ->
    nextState = @getStepState(nextProps)

    @setState(nextState)

      onNextStep: ->
        channel.emit("leave.#{step.id}")

      waitingText: (isWaiting and ' Saving…') or ''

    if taskId?
      wrapperProps =
        'data-step-number': tasks.getStepIndex(taskId, step.id) + 1
