jam-cloud/web/app/assets/javascripts/react-components/SessionTrackVU.js.jsx.coffee

44 lines
1.4 KiB
CoffeeScript

context = window
@SessionTrackVU = React.createClass({
getInitialState: () ->
{mixers: this.props.mixers}
render: () ->
lights = []
redSwitch = Math.round(this.props.lightCount * 0.66);
lightClass = 'vu-red-off'
if this.props.orientation == 'horizontal'
for i in [0..this.props.lightCount-1]
lightClass = if i >= redSwitch then 'vu-red-off' else 'vu-green-off'
lightClasses = classNames('vulight', 'vu' + i, lightClass)
lights.push(`<td key={i} width={this.props.lightWidth} height={this.props.lightHeight} className={lightClasses}></td>`)
tableClasses = classNames('vu', 'horizontal', this.props.side + '-' + this.state.mixers.mixer.mixerId)
`<table className={tableClasses} data-light-count={this.props.lightCount}>
<tr>
{lights}
</tr>
</table>`
else
for i in [0..this.props.lightCount-1].reverse()
lightClass = if (i >= redSwitch) then "vu-red-off" else "vu-green-off"
lightClasses = classNames('vulight', 'vu' + i, lightClass)
lights.push(`<tr><td key={i} width={this.props.lightWidth} height={this.props.lightHeight} className={lightClasses}></td></tr>`)
tableClasses = classNames('vu', 'vertical', this.props.side + '-' + this.state.mixers.mixer.mixerId)
`<table className={tableClasses} data-light-count={this.props.lightCount}>
{lights}
</table>`
})