74 lines
2.8 KiB
CoffeeScript
74 lines
2.8 KiB
CoffeeScript
context = window
|
|
RecordingActions = @RecordingActions
|
|
AppStore = context.AppStore
|
|
|
|
@SessionRecordBtn = React.createClass({
|
|
|
|
mixins: [Reflux.listenTo(@MixerStore,"onSessionMixerChange"), Reflux.listenTo(AppStore, "onAppInit")]
|
|
|
|
onAppInit: (@app) ->
|
|
|
|
onSessionMixerChange: (sessionMixers) ->
|
|
#console.log("_DEBUG_* SessionRecordBtn onSessionMixerChange", sessionMixers.session)
|
|
@setState({isRecording: sessionMixers.session.isRecording})
|
|
@setState({thisClientStartedRecording: sessionMixers.session.thisClientStartedRecording})
|
|
|
|
getInitialState: () ->
|
|
{childWindow: null, isRecording: false}
|
|
|
|
|
|
openBrowserToPayment: () ->
|
|
context.JK.popExternalLink("/client#/account/subscription", true)
|
|
|
|
openBrowserToPlanComparison: () ->
|
|
context.JK.popExternalLink("https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-")
|
|
return 'noclose'
|
|
|
|
handleClick: () ->
|
|
if @state.isRecording && @state.thisClientStartedRecording
|
|
RecordingActions.stopRecording()
|
|
else
|
|
@openRecording()
|
|
|
|
openRecording: () ->
|
|
canRecord = window.SessionStore.canRecord()
|
|
if canRecord
|
|
RecordingActions.openRecordingControls()
|
|
#@app.layout.showDialog('session-recording', {})
|
|
else
|
|
buttons = []
|
|
buttons.push({name: 'CLOSE', buttonStyle: 'button-grey'})
|
|
buttons.push({name: 'COMPARE PLANS', buttonStyle: 'button-grey', click: (() => (@openBrowserToPlanComparison()))})
|
|
buttons.push({
|
|
name: 'UPGRADE PLAN',
|
|
buttonStyle: 'button-orange',
|
|
click: (() => (@openBrowserToPayment()))
|
|
})
|
|
context.JK.Banner.show({
|
|
title: "Your Current Plan Does Not Allow Recording",
|
|
html: context._.template($('#template-plan-no-record').html(), {}, { variable: 'data' }),
|
|
buttons: buttons})
|
|
|
|
render: () ->
|
|
btnStyles = "session-record session-record-btn left"
|
|
|
|
if this.state.isRecording
|
|
if this.state.thisClientStartedRecording
|
|
btnStyles = btnStyles+' button-orange'
|
|
`<a className={btnStyles} data-is-recording={this.state.isRecording} onClick={this.handleClick}>
|
|
<img src="/assets/content/icon_record.png" align="texttop" height="14" width="14"/>
|
|
STOP RECORDING
|
|
</a>`
|
|
else
|
|
btnStyles = btnStyles+' button-grey'
|
|
`<a className={btnStyles} data-is-recording={this.state.isRecording}>
|
|
<img src="/assets/content/icon_record.png" align="texttop" height="14" width="14"/>
|
|
RECORDING IN-PROGRESS
|
|
</a>`
|
|
else
|
|
btnStyles = btnStyles+' button-grey'
|
|
`<a className={btnStyles} data-is-recording={this.state.isRecording} onClick={this.handleClick}>
|
|
<img src="/assets/content/icon_record.png" align="texttop" height="14" width="14"/>
|
|
RECORD
|
|
</a>`
|
|
}) |