97 lines
2.9 KiB
CoffeeScript
97 lines
2.9 KiB
CoffeeScript
context = window
|
|
|
|
MixerActions = @MixerActions
|
|
|
|
@SessionMyTrack = React.createClass({
|
|
|
|
|
|
handleMute: (e) ->
|
|
e.preventDefault()
|
|
|
|
unless this.props.mixers.mixer
|
|
logger.debug("ignoring mute; no mixer")
|
|
return
|
|
|
|
muting = $(e.currentTarget).is('.enabled')
|
|
|
|
MixerActions.mute([this.props.mixers.mixer, this.props.mixers.oppositeMixer], muting)
|
|
|
|
render: () ->
|
|
|
|
muteMixer = this.props.mixers.muteMixer
|
|
vuMixer = this.props.mixers.vuMixer
|
|
muteMixerId = muteMixer?.id
|
|
|
|
classes = classNames({
|
|
'track-icon-mute': true
|
|
'enabled' : !muteMixer?.mute
|
|
'muted' : muteMixer?.mute
|
|
})
|
|
|
|
pan = if this.props.mixers.mixer? then this.props.mixers.mixer.pan else 0
|
|
|
|
panStyle = {
|
|
transform: "rotate(#{pan}deg)"
|
|
WebkitTransform: "rotate(#{pan}deg)"
|
|
}
|
|
|
|
`<div className="session-track my-track">
|
|
<div className="disabled-track-overlay" />
|
|
<div className="session-track-contents">
|
|
<div className="name">{this.props.name}</div>
|
|
<div className="track-avatar"><img src={this.props.photoUrl}/></div>
|
|
<div className="track-instrument"><img height="45" src={this.props.instrumentIcon} width="45" /></div>
|
|
<div className="track-controls">
|
|
<SessionTrackVU orientation="horizontal" lightCount={4} lightWidth={17} lightHeight={3} side="vul" mixers={this.props.mixers} />
|
|
<div className="track-buttons">
|
|
<div className={classes} data-control="mute" data-mixer-id={muteMixerId} onClick={this.handleMute}/>
|
|
<div className="track-icon-pan" style={panStyle}/>
|
|
<div className="track-icon-equalizer" />
|
|
</div>
|
|
<br className="clearall"/>
|
|
</div>
|
|
|
|
|
|
<br className="clearall"/>
|
|
</div>
|
|
</div>`
|
|
|
|
componentDidMount: () ->
|
|
|
|
console.log("SessionSetUserName", this.props.clientId, this.props.name)
|
|
context.jamClient.SessionSetUserName(this.props.clientId, this.props.name)
|
|
|
|
$root = $(this.getDOMNode())
|
|
$mute = $root.find('.track-icon-mute')
|
|
$pan = $root.find('.track-icon-pan')
|
|
|
|
context.JK.interactReactBubble(
|
|
$mute,
|
|
'SessionTrackVolumeHover',
|
|
() =>
|
|
{mixers:this.props.mixers, mixerFinder: this.props.mixerFinder}
|
|
,
|
|
{width:235, positions:['right', 'left'], offsetParent:$root.closest('.screen')})
|
|
|
|
context.JK.interactReactBubble(
|
|
$pan,
|
|
'SessionTrackPanHover',
|
|
() =>
|
|
{mixers:this.props.mixers, mixerFinder: this.props.mixerFinder}
|
|
,
|
|
{width:331, positions:['right', 'left'], offsetParent:$root.closest('.screen')})
|
|
|
|
componentWillUpdate: (nextProps, nextState) ->
|
|
$root = $(this.getDOMNode())
|
|
$mute = $root.find('.track-icon-mute')
|
|
$pan = $root.find('.track-icon-pan')
|
|
|
|
# disable hover effects if there is no mixer
|
|
if nextProps.mixers.mixer?
|
|
$mute.off("click", false)
|
|
$pan.off("click", false)
|
|
else
|
|
$mute.on("click", false)
|
|
$pan.on("click", false)
|
|
})
|