UI actions; Context menu

This commit is contained in:
James Barnsley
2016-10-27 10:02:12 +13:00
parent 05e131ce75
commit 560fb4df19
19 changed files with 378 additions and 46 deletions

View File

@ -6,7 +6,9 @@ import { Link } from 'react-router'
import { connect } from 'react-redux'
import Sidebar from '../components/Sidebar'
import ContextMenu from '../components/ContextMenu'
import * as uiActions from '../services/ui/actions'
import * as mopidyActions from '../services/mopidy/actions'
import * as spotifyActions from '../services/spotify/actions'
@ -31,6 +33,8 @@ class App extends React.Component{
<main>
{this.props.children}
</main>
{ this.props.ui.context_menu.test }
<ContextMenu state={this.props.ui.context_menu} />
</div>
);
}
@ -48,6 +52,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch),
mopidyActions: bindActionCreators(mopidyActions, dispatch),
spotifyActions: bindActionCreators(spotifyActions, dispatch)
}

View File

@ -29,10 +29,14 @@ class Playlist extends React.Component{
render(){
if( this.props.spotify.playlist ){
var context = null;
if( this.props.spotify.playlist.owner.id == this.props.spotify.me.id ) context = 'editable-playlist'
return (
<div className="view playlist-view">
<Header icon="playlist" title={ this.props.spotify.playlist.name } />
<TrackList tracks={this.props.spotify.playlist.tracks.items} />
<TrackList context={context} tracks={this.props.spotify.playlist.tracks.items} />
</div>
);
}

View File

@ -36,7 +36,7 @@ class Queue extends React.Component{
if( this.props.mopidy && this.props.mopidy.tracks ){
return (
<TrackList
type="tltrack"
context="queue"
tracks={this.props.mopidy.tracks}
removeTracks={ tracks => this.removeTracks( tracks ) }
playTracks={ null }

View File

@ -0,0 +1,49 @@
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import Header from '../../components/Header'
import AlbumGrid from '../../components/AlbumGrid'
import * as spotifyActions from '../../services/spotify/actions'
class DiscoverNewReleases extends React.Component{
constructor(props) {
super(props);
}
// on render
componentDidMount(){
this.props.spotifyActions.getNewReleases();
}
render(){
return (
<div className="view discover-new-releases-view">
<Header icon="leaf" title="New Releases" />
{ this.props.spotify.new_releases ? <AlbumGrid albums={this.props.spotify.new_releases.items} /> : null }
</div>
);
}
}
/**
* Export our component
*
* We also integrate our global store, using connect()
**/
const mapStateToProps = (state, ownProps) => {
return state;
}
const mapDispatchToProps = (dispatch) => {
return {
spotifyActions: bindActionCreators(spotifyActions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(DiscoverNewReleases)