76 lines
2.3 KiB
CoffeeScript
76 lines
2.3 KiB
CoffeeScript
context = window
|
|
|
|
|
|
ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
|
|
|
|
|
|
@SessionMyTracks = React.createClass({
|
|
|
|
mixins: [Reflux.listenTo(@SessionMyTracksStore,"onInputsChanged"), Reflux.listenTo(@AppStore,"onAppInit")]
|
|
|
|
onInputsChanged: (sessionMixers) ->
|
|
|
|
session = sessionMixers.session
|
|
mixers = sessionMixers.mixers
|
|
|
|
tracks = []
|
|
|
|
if session.inSession()
|
|
participant = session.getParticipant(@app.clientId)
|
|
|
|
name = participant.user.name;
|
|
|
|
for track in participant.tracks
|
|
# try to find mixer info for this track
|
|
mixerFinder = [participant.client_id, track, true]
|
|
mixerData = mixers.findMixerForTrack(participant.client_id, track, true)
|
|
mixerData.mixerFinder = mixerFinder # so that other callers can re-find their mixer data
|
|
|
|
# todo: sessionModel.setAudioEstablished
|
|
|
|
instrumentIcon = context.JK.getInstrumentIcon45(track.instrument_id);
|
|
photoUrl = context.JK.resolveAvatarUrl(participant.user.photo_url);
|
|
|
|
tracks.push({track: track, mixerFinder: mixerFinder, mixers: mixerData, name: name, instrumentIcon: instrumentIcon, photoUrl: photoUrl})
|
|
|
|
# TODO: also deal with chat
|
|
|
|
this.setState(tracks: tracks, session:session)
|
|
|
|
render: () ->
|
|
|
|
content = null
|
|
tracks = []
|
|
|
|
if this.state.tracks.length > 0
|
|
for track in this.state.tracks
|
|
tracks.push(`<SessionMyTrack key={track.track.client_track_id} {...track} />`)
|
|
|
|
else if this.state.session? && this.state.session.inSession()
|
|
content = `<div className="session-mytracks-notracks">
|
|
<p className="notice">
|
|
You have not set up any inputs for your instrument or vocals.
|
|
If you want to hear yourself play through the JamKazam app,
|
|
and let the app mix your live playing with JamTracks, or with other musicians in online sessions,
|
|
<a href="#" className="open-ftue-no-tracks">click here now.</a>
|
|
</p>
|
|
</div>`
|
|
|
|
`<div className="session-my-tracks">
|
|
<h2>my live tracks</h2>
|
|
<SessionTrackSettingsBtn />
|
|
<div className="session-tracks-scroller">
|
|
{content}
|
|
<ReactCSSTransitionGroup transitionName="session-track-list" transitionAppear={true}>
|
|
{tracks}
|
|
</ReactCSSTransitionGroup>
|
|
</div>
|
|
</div>`
|
|
|
|
getInitialState:() ->
|
|
{tracks:[], session: null}
|
|
|
|
onAppInit: (app) ->
|
|
@app = app
|
|
})
|