import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import { Link, hashHistory } from 'react-router' import FontAwesome from 'react-fontawesome' import ArtistSentence from './ArtistSentence' import * as helpers from '../helpers' import * as coreActions from '../services/core/actions' import * as uiActions from '../services/ui/actions' import * as pusherActions from '../services/pusher/actions' class Snapcast extends React.Component{ constructor(props){ super(props) } render(){ if (!this.props.snapcast){ return null; } return (
{ this.props.snapcast.groups.map(group => { return (
{group.muted ? : } {group.name ? group.name : 'Untitled'}
{ group.clients.map(client => { return (
{client.config.volume.muted ? this.props.pusherActions.setSnapcastClientVolume(client.id, false, client.config.volume.percent)} /> : this.props.pusherActions.setSnapcastClientVolume(client.id, true, client.config.volume.percent)} />} {client.config.name} {client.config.volume.percent}
); }) }
); }) }
); } } const mapStateToProps = (state, ownProps) => { return { snapcast: state.pusher.snapcast } } const mapDispatchToProps = (dispatch) => { return { coreActions: bindActionCreators(coreActions, dispatch), uiActions: bindActionCreators(uiActions, dispatch), pusherActions: bindActionCreators(pusherActions, dispatch) } } export default connect(mapStateToProps, mapDispatchToProps)(Snapcast)