2016-10-23 23:48:06 +13:00
|
|
|
|
|
|
|
|
import React, { PropTypes } from 'react'
|
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
|
import { bindActionCreators } from 'redux'
|
2017-06-21 09:12:14 +12:00
|
|
|
import { Link, withRouter } from 'react-router'
|
2016-10-23 23:48:06 +13:00
|
|
|
|
2016-11-03 08:57:16 +13:00
|
|
|
import Icon from './Icon'
|
2016-11-10 21:33:23 +13:00
|
|
|
import Dropzones from './Dropzones'
|
2017-06-16 15:40:39 +12:00
|
|
|
import Thumbnail from './Thumbnail'
|
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) {
|
2016-11-21 21:46:53 +13:00
|
|
|
super(props)
|
2016-10-23 23:48:06 +13:00
|
|
|
}
|
|
|
|
|
|
2017-06-21 09:12:14 +12:00
|
|
|
linkClassName(link){
|
|
|
|
|
if (this.props.location.pathname.startsWith('/'+link)){
|
|
|
|
|
return 'active'
|
|
|
|
|
} else {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-23 23:48:06 +13:00
|
|
|
render(){
|
|
|
|
|
return (
|
|
|
|
|
<aside>
|
2016-11-22 11:10:30 +13:00
|
|
|
<div className="liner">
|
|
|
|
|
<nav>
|
|
|
|
|
|
|
|
|
|
<section>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('queue')} to={global.baseURL+"queue"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="play" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Now playing
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('search')} to={global.baseURL+"search"}>
|
2017-06-20 19:55:47 +12:00
|
|
|
<Icon name="search" />
|
|
|
|
|
Search
|
|
|
|
|
</Link>
|
2016-11-22 11:10:30 +13:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<title>Discover</title>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('discover/recommendations')} to={global.baseURL+"discover/recommendations"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="compass" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Discover
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('discover/categories')} to={global.baseURL+"discover/categories"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="grid" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Genre / Mood
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('discover/featured')} to={global.baseURL+"discover/featured"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="star" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Featured playlists
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('discover/new-releases')} to={global.baseURL+"discover/new-releases"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="leaf" />
|
2016-11-22 11:10:30 +13:00
|
|
|
New releases
|
|
|
|
|
</Link>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
<title>My Music</title>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('library/playlists')} to={global.baseURL+"library/playlists"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="playlist" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Playlists
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('library/artists')} disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/artists" : null}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="mic" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Artists
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('library/albums')} disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/albums" : null}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="cd" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Albums
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('library/tracks')} disabled={!this.props.spotify_authorized} to={this.props.spotify_authorized ? global.baseURL+"library/tracks" : null}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="music" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Tracks
|
|
|
|
|
</Link>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('library/local')} to={global.baseURL+"library/local"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="folder" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Local
|
|
|
|
|
</Link>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section>
|
2017-06-21 09:12:14 +12:00
|
|
|
<Link className={this.linkClassName('settings')} to={global.baseURL+"settings"}>
|
2017-06-18 05:47:36 +12:00
|
|
|
<Icon name="cog" />
|
2016-11-22 11:10:30 +13:00
|
|
|
Settings
|
|
|
|
|
{ !this.props.mopidy_connected || !this.props.spotify_connected || !this.props.pusher_connected ? <FontAwesome name="exclamation-triangle" className="red-text pull-right" /> : null }
|
|
|
|
|
</Link>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
</div>
|
2016-10-23 23:48:06 +13:00
|
|
|
|
2016-11-10 21:33:23 +13:00
|
|
|
<Dropzones />
|
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,
|
2017-06-07 09:05:56 +12:00
|
|
|
spotify_authorized: state.spotify.authorized,
|
2016-11-10 16:17:10 +13:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-21 09:12:14 +12:00
|
|
|
// We wrap our Sidebar with the Router, and then to the redux store
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(withRouter(Sidebar))
|