import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import { Link, hashHistory } from 'react-router' import ArtistSentence from './ArtistSentence' import VolumeControl from './Fields/VolumeControl' import LatencyControl from './Fields/LatencyControl' import TextField from './Fields/TextField' import DropdownField from './Fields/DropdownField' 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' import * as snapcastActions from '../services/snapcast/actions' class Snapcast extends React.Component{ constructor(props){ super(props); } componentDidMount(){ if (this.props.pusher_connected && this.props.snapcast_enabled){ this.props.snapcastActions.getServer(); } } componentWillReceiveProps(newProps){ // Just connected if (newProps.snapcast_enabled && !this.props.pusher_connected && newProps.pusher_connected){ this.props.snapcastActions.getServer(); // Just enabled // This is the more probable scenario as we don't know if we're enabled until pusher connects // and then gets the config from the server } else if (!this.props.snapcast_enabled && newProps.snapcast_enabled && newProps.pusher_connected){ this.props.snapcastActions.getServer(); } } renderClientsList(group, groups){ if (!group.clients || group.clients.length <= 0){ return (
To enable Snapcast, edit your mopidy.conf file