diff --git a/src/js/index.js b/src/js/index.js index e580ad5c..2d6b8c5e 100755 --- a/src/js/index.js +++ b/src/js/index.js @@ -62,7 +62,7 @@ ReactDOM.render( - + diff --git a/src/js/services/ui/middleware.js b/src/js/services/ui/middleware.js index bdd6b41e..bab903a6 100755 --- a/src/js/services/ui/middleware.js +++ b/src/js/services/ui/middleware.js @@ -250,7 +250,7 @@ const UIMiddleware = (function(){ break case 'CLOSE_MODAL': - ReactGA.event({ category: 'Modal', action: 'Closed', label: action.modal.name }) + ReactGA.event({ category: 'Modal', action: 'Closed', label: null }) $('body').removeClass('modal-open') next(action) break diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js index 34038f81..bef3c5d1 100755 --- a/src/js/views/Artist.js +++ b/src/js/views/Artist.js @@ -2,6 +2,7 @@ import React, { PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' +import { Link } from 'react-router' import FontAwesome from 'react-fontawesome' import LazyLoadListener from '../components/LazyLoadListener' @@ -27,10 +28,6 @@ class Artist extends React.Component{ constructor(props) { super(props) - - this.state = { - sub_view: 'overview' - } } componentDidMount(){ @@ -48,8 +45,8 @@ class Artist extends React.Component{ } componentWillUpdate( nextProps, nextState ){ - if( nextState.sub_view != this.state.sub_view && nextState.sub_view == 'about' ){ - if( this.props.artist && !this.props.artist.bio ){ + if (nextProps.params.sub_view != this.props.params.sub_view && nextProps.params.sub_view == 'about'){ + if (this.props.artist && !this.props.artist.bio){ this.props.lastfmActions.getArtist( this.props.params.uri, this.props.artist.name.replace('&','and') ) } } @@ -86,9 +83,6 @@ class Artist extends React.Component{ } break } - - // go back to overview - this.setState({ sub_view: 'overview' }) } loadMore(){ @@ -102,13 +96,9 @@ class Artist extends React.Component{ renderSubViewMenu(){ return (
- this.setState({ sub_view: 'overview' })}> - Overview - - {this.props.artist.related_artists_uris ? this.setState({ sub_view: 'related_artists' })}>Related artists : null} - this.setState({ sub_view: 'about' })}> - About - + Overview + Related artists + About
) } @@ -136,60 +126,64 @@ class Artist extends React.Component{ } } - if( this.state.sub_view == 'related_artists' ){ - return ( -
-

Related artists

-
- -
-
- ) - }else if( this.state.sub_view == 'about' ){ - return ( -
+ switch (this.props.params.sub_view){ -
- {this.props.artist.images_additional ?
: null} - {this.props.artist.followers ?
{this.props.artist.followers.total.toLocaleString() } followers
: null} - {this.props.artist.popularity ?
{this.props.artist.popularity }% popularity
: null} - {this.props.artist.listeners ?
{ this.props.artist.listeners.toLocaleString() } listeners
: null } -
- -
-

Biography

-
- { this.props.artist.bio ?

{this.props.artist.bio.content}


-
Published: { this.props.artist.bio.published }
-
: null } + case 'related-artists': + return ( +
+

Related artists

+
+
-
- ) - } + ) - return ( -
-
0 ? "col w70" : "col w100"}> -

Top tracks

-
- { this.props.artist.tracks ? : null } + case 'about': + return ( +
+ +
+ {this.props.artist.images_additional ?
: null} + {this.props.artist.followers ?
{this.props.artist.followers.total.toLocaleString() } followers
: null} + {this.props.artist.popularity ?
{this.props.artist.popularity }% popularity
: null} + {this.props.artist.listeners ?
{ this.props.artist.listeners.toLocaleString() } listeners
: null } +
+ +
+

Biography

+
+ { this.props.artist.bio ?

{this.props.artist.bio.content}


+
Published: { this.props.artist.bio.published }
+
: null } +
+
-
+ ) -
+ default: + return ( +
+
0 ? "col w70" : "col w100"}> +

Top tracks

+
+ { this.props.artist.tracks ? : null } +
+
- {related_artists.length > 0 ?

Related artists

: null} +
-
+ {related_artists.length > 0 ?

Related artists

: null} -

Albums

-
- - this.loadMore() }/> -
-
- ) +
+ +

Albums

+
+ + this.loadMore() }/> +
+
+ ) + } } render(){