 {TaskPlanStore, TaskPlanActions} = require '../../flux/task-plan'
 {PlanPublishStore, PlanPublishActions} = require '../../flux/plan-publish'
 PlanHelper = require '../../helpers/plan'
-{AsyncButton} = require 'openstax-react-components'
+{AsyncButton, SuretyGuard} = require 'openstax-react-components'
 TutorDialog = require '../tutor-dialog'
 BackButton = require '../buttons/back-button'
 


  onDelete: ->
    {id, courseId} = @props
    if confirm('Are you sure you want to delete this?')
      TaskPlanActions.delete(id)
      @props.goBackToCalendar()

  onSave: ->
    @setState({saving: true, publishing: false})


  onPublish: ->
    @setState({publishing: true, saving: false, isEditable: TaskPlanStore.isEditable(@props.id)})

    if TaskPlanStore.isPublished(@props.id)
      @props.onPublish()
    else
      @props.onSave()

  onViewStats: ->
    {id, courseId} = @props
