Merging into one
This commit is contained in:
@ -78,12 +78,12 @@ class AddSeedField extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
results(){
|
results(){
|
||||||
if (typeof(this.props.results) === 'undefined'){
|
if (this.props.results === undefined){
|
||||||
return null
|
return null;
|
||||||
} else if (typeof(this.props.results[this.id]) === 'undefined'){
|
} else if (this.props.results[this.id] === undefined){
|
||||||
return null
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return this.props.results[this.id]
|
return this.props.results[this.id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class AddSeedField extends React.Component{
|
|||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
return {
|
return {
|
||||||
genres: (state.ui.genres ? state.ui.genres : null),
|
genres: (state.spotify.genres ? state.spotify.genres : null),
|
||||||
results: (state.spotify.autocomplete_results ? state.spotify.autocomplete_results : {})
|
results: (state.spotify.autocomplete_results ? state.spotify.autocomplete_results : {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -653,7 +653,7 @@ export function getAutocompleteResults(field_id, query, types = ['album','artist
|
|||||||
response => {
|
response => {
|
||||||
var genres = []
|
var genres = []
|
||||||
if (genre_included){
|
if (genre_included){
|
||||||
var available_genres = getState().ui.genres
|
var available_genres = getState().spotify.genres
|
||||||
if (available_genres){
|
if (available_genres){
|
||||||
for (var i = 0; i < available_genres.length; i++){
|
for (var i = 0; i < available_genres.length; i++){
|
||||||
if (available_genres[i].includes(query)){
|
if (available_genres[i].includes(query)){
|
||||||
@ -666,6 +666,35 @@ export function getAutocompleteResults(field_id, query, types = ['album','artist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (response.artists && response.artists.items){
|
||||||
|
dispatch({
|
||||||
|
type: 'ARTISTS_LOADED',
|
||||||
|
artists: response.artists.items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.albums && response.albums.items){
|
||||||
|
dispatch({
|
||||||
|
type: 'ALBUMS_LOADED',
|
||||||
|
albums: response.albums.items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.playlists && response.playlists.items){
|
||||||
|
dispatch({
|
||||||
|
type: 'PLAYLISTS_LOADED',
|
||||||
|
playlists: response.playlists.items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.tracks && response.tracks.items){
|
||||||
|
dispatch({
|
||||||
|
type: 'TRACKS_LOADED',
|
||||||
|
tracks: response.tracks.items
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'SPOTIFY_AUTOCOMPLETE_LOADED',
|
type: 'SPOTIFY_AUTOCOMPLETE_LOADED',
|
||||||
field_id: field_id,
|
field_id: field_id,
|
||||||
|
|||||||
@ -162,6 +162,14 @@ export default function reducer(spotify = {}, action){
|
|||||||
autocomplete_results: autocomplete_results
|
autocomplete_results: autocomplete_results
|
||||||
})
|
})
|
||||||
|
|
||||||
|
case 'SPOTIFY_GENRES_LOADED':
|
||||||
|
return Object.assign(
|
||||||
|
{},
|
||||||
|
spotify,
|
||||||
|
{
|
||||||
|
genres: action.genres
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library
|
* Library
|
||||||
|
|||||||
@ -108,8 +108,8 @@ class Discover extends React.Component{
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 100,
|
||||||
value: {
|
value: {
|
||||||
min: 25,
|
min: 0,
|
||||||
max: 75
|
max: 100
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
speechiness: {
|
speechiness: {
|
||||||
@ -303,7 +303,6 @@ class Discover extends React.Component{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="seeds">
|
<div className="seeds">
|
||||||
<h4 className="underline">Seeds</h4>
|
|
||||||
{
|
{
|
||||||
seeds_objects.map((seed,index) => {
|
seeds_objects.map((seed,index) => {
|
||||||
var type = helpers.uriType(seed.uri)
|
var type = helpers.uriType(seed.uri)
|
||||||
@ -360,7 +359,6 @@ class Discover extends React.Component{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="tunabilities">
|
<div className="tunabilities">
|
||||||
<h4 className="underline">Musical properties</h4>
|
|
||||||
{
|
{
|
||||||
enabled_tunabilities.map(tunability => {
|
enabled_tunabilities.map(tunability => {
|
||||||
return (
|
return (
|
||||||
@ -390,14 +388,8 @@ class Discover extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderResults(){
|
renderResults(){
|
||||||
if (helpers.isLoading(this.props.load_queue,['spotify_recommendations'])){
|
|
||||||
return (
|
// Results not in
|
||||||
<div className="body-loader loading">
|
|
||||||
<div className="loader"></div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.props.recommendations || this.props.recommendations.albums_uris === undefined || this.props.recommendations.artists_uris === undefined){
|
if (!this.props.recommendations || this.props.recommendations.albums_uris === undefined || this.props.recommendations.artists_uris === undefined){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -432,6 +424,11 @@ class Discover extends React.Component{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Complete records not yet in our index
|
||||||
|
if (tracks.length <= 0 && artists.length <= 0 && albums.length <= 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var uri = 'iris:discover';
|
var uri = 'iris:discover';
|
||||||
if (this.state.seeds){
|
if (this.state.seeds){
|
||||||
uri += ':';
|
uri += ':';
|
||||||
@ -475,6 +472,7 @@ class Discover extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
|
var is_loading = helpers.isLoading(this.props.load_queue,['spotify_recommendations']);
|
||||||
var addable_tunabilities = [];
|
var addable_tunabilities = [];
|
||||||
for (var key in this.state.tunabilities){
|
for (var key in this.state.tunabilities){
|
||||||
if (this.state.tunabilities.hasOwnProperty(key)){
|
if (this.state.tunabilities.hasOwnProperty(key)){
|
||||||
@ -507,10 +505,12 @@ class Discover extends React.Component{
|
|||||||
<h2 className="grey-text">
|
<h2 className="grey-text">
|
||||||
Add seeds and musical properties below to build your sound
|
Add seeds and musical properties below to build your sound
|
||||||
</h2>
|
</h2>
|
||||||
{this.renderSeeds()}
|
<div className="parameters">
|
||||||
{this.renderTunabilities()}
|
{this.renderSeeds()}
|
||||||
|
{this.renderTunabilities()}
|
||||||
|
</div>
|
||||||
<div className="actions">
|
<div className="actions">
|
||||||
<span className="button primary large" onClick={e => this.getRecommendations()}>
|
<span className={"button primary large"+(is_loading ? " working" : "")} onClick={e => this.getRecommendations()}>
|
||||||
<FontAwesome name="compass" />
|
<FontAwesome name="compass" />
|
||||||
Find recommendations
|
Find recommendations
|
||||||
</span>
|
</span>
|
||||||
@ -542,9 +542,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
authorized: state.spotify.authorization,
|
authorized: state.spotify.authorization,
|
||||||
load_queue: state.ui.load_queue,
|
load_queue: state.ui.load_queue,
|
||||||
quick_search_results: (state.spotify.quick_search_results ? state.spotify.quick_search_results : {artists: [], tracks: []}),
|
quick_search_results: (state.spotify.quick_search_results ? state.spotify.quick_search_results : {artists: [], tracks: []}),
|
||||||
recommendations: (state.spotify.recommendations ? state.spotify.recommendations : {}),
|
recommendations: (state.spotify.recommendations ? state.spotify.recommendations : {})
|
||||||
favorite_artists: (state.spotify.favorite_artists ? state.spotify.favorite_artists : []),
|
|
||||||
favorite_tracks: (state.spotify.favorite_tracks ? state.spotify.favorite_tracks : [])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -168,6 +168,8 @@ input[type="submit"] {
|
|||||||
&.working {
|
&.working {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: wait !important;
|
cursor: wait !important;
|
||||||
|
background: $grey;
|
||||||
|
color: $mid_grey;
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@ -175,7 +177,7 @@ input[type="submit"] {
|
|||||||
display: block;
|
display: block;
|
||||||
content: '';
|
content: '';
|
||||||
animation: slideloader 1s infinite;
|
animation: slideloader 1s infinite;
|
||||||
background: rgba(200,200,200,0.4);
|
background: rgba(200,200,200,0.3);
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@ -117,9 +117,21 @@ $bp_shallow: 650px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes slideloader {
|
@keyframes slideloader {
|
||||||
0% { left: 0%; right: 100%; }
|
0% {
|
||||||
50% { left: 0%; right: 0%; }
|
left: 0%;
|
||||||
100% { left: 100%; right: 0%; }
|
right: 100%;
|
||||||
|
border-radius: 3px 0 0 3px;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
left: 0%;
|
||||||
|
right: 0%;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
left: 100%;
|
||||||
|
right: 0%;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,12 +31,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.seeds,
|
.parameters {
|
||||||
.tunabilities {
|
|
||||||
padding-top: 30px;
|
padding-top: 30px;
|
||||||
|
|
||||||
h3 {
|
.seeds,
|
||||||
padding-bottom: 6px;
|
.tunabilities {
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: $blue;
|
background: $blue;
|
||||||
color: $white;
|
color: $white;
|
||||||
padding: 8px 26px 8px 14px;
|
padding: 8px 26px 6px 14px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
position: relative;
|
position: relative;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
@ -118,7 +118,7 @@
|
|||||||
input {
|
input {
|
||||||
background: rgba(100,100,100,0.5);
|
background: rgba(100,100,100,0.5);
|
||||||
color: $white;
|
color: $white;
|
||||||
padding: 7px 13px;
|
padding: 8px 13px 6px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user