+
+
+ spotify playlist can be the name of either your own created playlist or one you follow, names are case sensitive
+
+
+ placeholder="spotify playlist name">
add
@@ -258,7 +294,9 @@ class PlaylistView extends Component{
className="full-width"
value={this.state.newPlaylistReference}
onChange={this.handleInputChange}>
- { this.state.playlists.map((entry) => ) }
+ { this.state.playlists
+ .filter((entry) => entry.name != this.state.name)
+ .map((entry) => ) }
@@ -287,7 +325,7 @@ class PlaylistView extends Component{
- recommendations sample size
+ number of recommendations
{ this.state.type == 'recents' &&
-
+
added since (days)
@@ -309,7 +347,16 @@ class PlaylistView extends Component{
value={this.state.day_boundary}
onChange={this.handleInputChange}>
-
+
+ }
+ { this.state.type == 'recents' &&
+
+
+ 'recents' playlists search for and include this months and last months playlists when named in the format
+ [month] [year]
+ e.g july 19 (lowercase)
+
+
}
diff --git a/src/js/Playlist/PlaylistsView.js b/src/js/Playlist/PlaylistsView.js
index 024340f..d0c3a09 100644
--- a/src/js/Playlist/PlaylistsView.js
+++ b/src/js/Playlist/PlaylistsView.js
@@ -41,12 +41,21 @@ class PlaylistsView extends Component {
}
handleRunPlaylist(name, event){
- axios.get('/api/playlist/run', {params: {name: name}})
+ axios.get('/api/user')
.then((response) => {
- showMessage(`${name} ran`);
- })
- .catch((error) => {
- showMessage(`error running ${name} (${error.response.status})`);
+ if(response.data.spotify_linked == true){
+ axios.get('/api/playlist/run', {params: {name: name}})
+ .then((response) => {
+ showMessage(`${name} ran`);
+ })
+ .catch((error) => {
+ showMessage(`error running ${name} (${error.response.status})`);
+ });
+ }else{
+ showMessage(`link spotify before running`);
+ }
+ }).catch((error) => {
+ showMessage(`error running ${this.state.name} (${error.response.status})`);
});
}
@@ -61,12 +70,21 @@ class PlaylistsView extends Component {
}
handleRunAll(event){
- axios.get('/api/playlist/run/user')
+ axios.get('/api/user')
.then((response) => {
- showMessage("all playlists ran");
- })
- .catch((error) => {
- showMessage(`error running all (${error.response.status})`);
+ if(response.data.spotify_linked == true){
+ axios.get('/api/playlist/run/user')
+ .then((response) => {
+ showMessage("all playlists ran");
+ })
+ .catch((error) => {
+ showMessage(`error running all (${error.response.status})`);
+ });
+ }else{
+ showMessage(`link spotify before running`);
+ }
+ }).catch((error) => {
+ showMessage(`error running ${this.state.name} (${error.response.status})`);
});
}
@@ -88,16 +106,25 @@ class PlaylistsView extends Component {
function Table(props){
return (
+ { props.playlists.length == 0 ? (
+
+
+
+ no playlists
+
+
+
+ ) : (
{ props.playlists.map((playlist) =>
) }
- { props.playlists.length > 0 &&
run all
- }
+
+ )}
);
}