context = window

@SessionMixerBtn = React.createClass({

  openDialog: (e) ->
    e.preventDefault()

    sessionController = context.SessionStore.helper.sessionController()

    # does this user have access to control the master mixer?

    if sessionController.can_control
      context.JK.app.layout.showDialog('session-master-mix-dialog')
    else
      sessionControllerName = sessionController.session_controller?.name
      $node = $(this.getDOMNode())
      window.JK.prodBubble($node, 'not-session-controller', {sessionControllerName:sessionControllerName}, {positions:['bottom'], offsetParent: $node.closest('.top-parent'), duration:12000})

  render: () ->
    `<a className="session-mixer button-grey left" onClick={this.openDialog}>
      <img src="/assets/content/icon_mixer.png" align="texttop" height="14" width="14"/>
      MIXER
    </a>`
})