2016-10-23 23:48:06 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
|
import { Link } from 'react-router'
|
|
|
|
|
|
2016-11-04 13:51:17 +13:00
|
|
|
import MiniPlayer from './MiniPlayer'
|
2016-11-03 08:57:16 +13:00
|
|
|
import Icon from './Icon'
|
|
|
|
|
import Thumbnail from './Thumbnail'
|
|
|
|
|
import SearchForm from './SearchForm'
|
2016-11-10 21:33:23 +13:00
|
|
|
import Dropzones from './Dropzones'
|
2016-10-23 23:48:06 +13:00
|
|
|
|
|
|
|
|
import FontAwesome from 'react-fontawesome'
|
|
|
|
|
import * as mopidyActions from '../services/mopidy/actions'
|
|
|
|
|
|
|
|
|
|
class Sidebar extends React.Component{
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render(){
|
|
|
|
|
return (
|
|
|
|
|
<aside>
|
2016-10-24 21:26:01 +13:00
|
|
|
|
2016-11-09 13:18:03 +13:00
|
|
|
{ this.props.current_track && this.props.current_track.album.images ? <Thumbnail size="large" images={this.props.current_track.album.images} /> : null }
|
2016-10-23 23:48:06 +13:00
|
|
|
|
2016-11-03 08:57:16 +13:00
|
|
|
<SearchForm context="sidebar" />
|
|
|
|
|
|
2016-10-23 23:48:06 +13:00
|
|
|
<nav>
|
|
|
|
|
|
|
|
|
|
<section>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Link activeClassName="active" to="/queue">
|
|
|
|
|
<Icon name="play" className="white" />
|
|
|
|
|
Now playing
|
|
|
|
|
</Link>
|
2016-10-23 23:48:06 +13:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<title>Discover</title>
|
2016-10-26 16:55:47 +13:00
|
|
|
<Link activeClassName="active" to="/discover">
|
|
|
|
|
<Icon name="compass" className="white" />
|
|
|
|
|
Discover
|
|
|
|
|
</Link>
|
|
|
|
|
<Link activeClassName="active" to="/discover/categories">
|
|
|
|
|
<Icon name="grid" className="white" />
|
|
|
|
|
Genre / Mood
|
|
|
|
|
</Link>
|
|
|
|
|
<Link activeClassName="active" to="/discover/featured">
|
|
|
|
|
<Icon name="star" className="white" />
|
|
|
|
|
Featured playlists
|
|
|
|
|
</Link>
|
2016-10-27 10:02:12 +13:00
|
|
|
<Link activeClassName="active" to="/discover/new-releases">
|
|
|
|
|
<Icon name="leaf" className="white" />
|
|
|
|
|
New releases
|
|
|
|
|
</Link>
|
2016-10-23 23:48:06 +13:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<title>My Music</title>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Link activeClassName="active" to="/library/playlists">
|
|
|
|
|
<Icon name="playlist" className="white" />
|
|
|
|
|
Playlists
|
|
|
|
|
</Link>
|
2016-11-14 11:20:02 +13:00
|
|
|
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/artists" : null}>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Icon name="mic" className="white" />
|
|
|
|
|
Artists
|
|
|
|
|
</Link>
|
2016-11-14 11:20:02 +13:00
|
|
|
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/albums" : null}>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Icon name="cd" className="white" />
|
|
|
|
|
Albums
|
|
|
|
|
</Link>
|
2016-11-14 11:20:02 +13:00
|
|
|
<Link activeClassName="active" disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? "/library/tracks" : null}>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Icon name="music" className="white" />
|
|
|
|
|
Tracks
|
|
|
|
|
</Link>
|
2016-11-01 07:37:18 +13:00
|
|
|
<Link activeClassName="active" to="/library/local">
|
|
|
|
|
<Icon name="folder" className="white" />
|
|
|
|
|
Local
|
|
|
|
|
</Link>
|
2016-10-23 23:48:06 +13:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
2016-10-24 21:26:01 +13:00
|
|
|
<Link activeClassName="active" to="/settings">
|
|
|
|
|
<Icon name="cog" className="white" />
|
|
|
|
|
Settings
|
2016-11-09 13:18:03 +13:00
|
|
|
{ !this.props.mopidy_connected || !this.props.spotify_connected || !this.props.pusher_connected ? <FontAwesome name="exclamation-triangle" className="red-text pull-right" /> : null }
|
2016-10-24 21:26:01 +13:00
|
|
|
</Link>
|
2016-10-23 23:48:06 +13:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
2016-11-10 21:33:23 +13:00
|
|
|
<Dropzones />
|
2016-11-04 13:51:17 +13:00
|
|
|
<MiniPlayer />
|
2016-10-23 23:48:06 +13:00
|
|
|
|
|
|
|
|
</aside>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Export our component
|
|
|
|
|
*
|
|
|
|
|
* We also integrate our global store, using connect()
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, ownProps) => {
|
2016-11-09 13:18:03 +13:00
|
|
|
return {
|
|
|
|
|
mopidy_connected: state.mopidy.connected,
|
|
|
|
|
pusher_connected: state.pusher.connected,
|
|
|
|
|
spotify_connected: state.spotify.connected,
|
|
|
|
|
spotify_authorized: state.spotify.authorized,
|
2016-11-10 16:17:10 +13:00
|
|
|
current_track: state.ui.current_track,
|
|
|
|
|
dragger: state.ui.dragger
|
2016-11-09 13:18:03 +13:00
|
|
|
}
|
2016-10-23 23:48:06 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
|
|
|
|
mopidyActions: bindActionCreators(mopidyActions, dispatch)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Sidebar)
|