import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import TrackList from '../components/TrackList' import Thumbnail from '../components/Thumbnail' import Dater from '../components/Dater' import * as spotifyActions from '../services/spotify/actions' import * as mopidyActions from '../services/mopidy/actions' class Playlist extends React.Component{ constructor(props) { super(props); } // on render componentDidMount(){ this.props.spotifyActions.getPlaylist( this.props.params.uri ); } // when props changed componentWillReceiveProps( nextProps ){ if( nextProps.params.uri != this.props.params.uri ){ this.props.spotifyActions.getPlaylist( nextProps.params.uri ); } } render(){ if( this.props.spotify.playlist ){ var playlist = this.props.spotify.playlist; var context = null; if( playlist.owner.id == this.props.spotify.me.id ) context = 'editable-playlist' return (