diff --git a/app/actions/index.js b/app/actions/index.js index 784851c5a7..f4d0a71255 100644 --- a/app/actions/index.js +++ b/app/actions/index.js @@ -309,10 +309,18 @@ export function albumInfoSearchByName (albumName, history) { .then(searchResults => searchResults.json()) .then(searchResultsJson => { let album = searchResultsJson.results[0]; - dispatch(albumInfoSearch(album.id, album.type)); - if (history) { - history.push('/album/' + album.id); + if (album.type == 'artist') { + dispatch(lastFmArtistInfoSearch(album.title, album.id)); + if (history) { + history.push('/artist/' + album.id); + } + } else { + dispatch(albumInfoSearch(album.id, album.type)); + if (history) { + history.push('/album/' + album.id); + } } + }) .catch(error => { logger.error(error); diff --git a/app/components/Dashboard/BestNewMusicTab/BestNewList/BestNewListActiveItem/index.js b/app/components/Dashboard/BestNewMusicTab/BestNewList/BestNewListActiveItem/index.js index 67f366f75a..b1a7d54c8f 100644 --- a/app/components/Dashboard/BestNewMusicTab/BestNewList/BestNewListActiveItem/index.js +++ b/app/components/Dashboard/BestNewMusicTab/BestNewList/BestNewListActiveItem/index.js @@ -7,8 +7,58 @@ class BestNewListActiveItem extends React.Component { super(props); } - render() { - let { item, artistInfoSearchByName, history } = this.props; + renderThumbnail (item) { + return (
+
+
); + } + + renderArtistTitleBox (item) { + return (
+
+ {this.props.albumInfoSearchByName ? this.props.albumInfoSearchByName(item.title + ' ' + item.artist, this.props.history)} + href='#' + > + {item.title} + : item.title} +
+
+ by{' '} + this.props.artistInfoSearchByName(item.artist, this.props.history)} + href='#' + > + {item.artist} + +
+
); + } + + renderReview (item) { + return (
+ {item.abstract ? ( +
{item.abstract}
+ ) : null} +
+ {item.review.split('\n').map(i => { + return ( + +
+ {i} +
+ ); + })} +
+
); + } + render () { + let { item } = this.props; if (!item) { return null; @@ -16,48 +66,16 @@ class BestNewListActiveItem extends React.Component { return (
-
-
-
+ {this.renderThumbnail(item)}
{item.score ? (
{item.score}
) : null} - - -
-
- {item.abstract ? ( -
{item.abstract}
- ) : null} -
- {item.review.split('\n').map(i => { - return ( - -
- {i} -
- ); - })} -
+ {this.renderArtistTitleBox(item)}
+
+ {this.renderReview(item)}
); diff --git a/app/components/Dashboard/BestNewMusicTab/BestNewList/index.js b/app/components/Dashboard/BestNewMusicTab/BestNewList/index.js index 58c4535d6d..c354ac7204 100644 --- a/app/components/Dashboard/BestNewMusicTab/BestNewList/index.js +++ b/app/components/Dashboard/BestNewMusicTab/BestNewList/index.js @@ -12,10 +12,11 @@ class BestNewList extends React.Component { }; } - render() { + render () { let { data, artistInfoSearchByName, + albumInfoSearchByName, history } = this.props; @@ -26,6 +27,7 @@ class BestNewList extends React.Component {
diff --git a/app/components/Dashboard/BestNewMusicTab/index.js b/app/components/Dashboard/BestNewMusicTab/index.js index f93db65cf0..6bb5f298d0 100644 --- a/app/components/Dashboard/BestNewMusicTab/index.js +++ b/app/components/Dashboard/BestNewMusicTab/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import {Dimmer, Loader, Tab} from 'semantic-ui-react'; +import { Tab } from 'semantic-ui-react'; import BestNewList from './BestNewList'; import styles from './styles.scss'; @@ -9,15 +9,16 @@ class BestNewMusicTab extends React.Component { super(props); } - isLoading() { + isLoading () { return this.props.dashboardData.bestNewAlbums.length < 1 || this.props.dashboardData.bestNewTracks.length < 1; } - render() { + render () { let { dashboardData, artistInfoSearchByName, - history + history, + albumInfoSearchByName } = this.props; return ( @@ -29,6 +30,7 @@ class BestNewMusicTab extends React.Component {
diff --git a/app/components/Dashboard/index.js b/app/components/Dashboard/index.js index 5b3ce3aefb..4627222b7c 100644 --- a/app/components/Dashboard/index.js +++ b/app/components/Dashboard/index.js @@ -7,7 +7,7 @@ import GenresTab from './GenresTab'; import NewsTab from './NewsTab'; class Dashboard extends React.Component { - panes() { + panes () { return [ { menuItem: 'Best new music', @@ -15,6 +15,7 @@ class Dashboard extends React.Component { ) @@ -54,7 +55,7 @@ class Dashboard extends React.Component { ]; } - componentDidMount() { + componentDidMount () { this.props.loadBestNewTracks(); this.props.loadBestNewAlbums(); this.props.loadNuclearNews(); @@ -62,7 +63,7 @@ class Dashboard extends React.Component { this.props.loadTopTracks(); } - render() { + render () { return (
diff --git a/app/containers/DashboardContainer/index.js b/app/containers/DashboardContainer/index.js index e2c5b9e10e..a71c60a2da 100644 --- a/app/containers/DashboardContainer/index.js +++ b/app/containers/DashboardContainer/index.js @@ -10,12 +10,13 @@ import * as PlayerActions from '../../actions/player'; import Dashboard from '../../components/Dashboard'; class DashboardContainer extends React.Component { - render() { - let { actions, dashboard, history, musicSources } = this.props; + render () { + let { actions, dashboard, history } = this.props; return (