Window title reflects current view; Hosted-instance tracking

This commit is contained in:
James Barnsley
2018-06-29 14:26:06 +12:00
parent 29f60071a9
commit 82fa3354c6
24 changed files with 23258 additions and 21027 deletions

View File

@ -8,6 +8,7 @@ import Icon from '../../components/Icon'
import CategoryGrid from '../../components/CategoryGrid'
import * as helpers from '../../helpers'
import * as uiActions from '../../services/ui/actions'
import * as spotifyActions from '../../services/spotify/actions'
class DiscoverCategories extends React.Component{
@ -20,6 +21,7 @@ class DiscoverCategories extends React.Component{
if (!this.props.categories){
this.props.spotifyActions.getCategories();
}
this.props.uiActions.setWindowTitle("Genre / Mood");
}
render(){
@ -74,6 +76,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch),
spotifyActions: bindActionCreators(spotifyActions, dispatch)
}
}

View File

@ -9,6 +9,7 @@ import PlaylistGrid from '../../components/PlaylistGrid'
import LazyLoadListener from '../../components/LazyLoadListener'
import * as helpers from '../../helpers'
import * as uiActions from '../../services/ui/actions'
import * as spotifyActions from '../../services/spotify/actions'
class DiscoverCategory extends React.Component{
@ -19,11 +20,24 @@ class DiscoverCategory extends React.Component{
componentDidMount(){
this.loadCategory();
this.setWindowTitle();
}
componentWillReceiveProps(nextProps){
if (nextProps.params.id != this.props.params.id){
this.loadCategory()
this.loadCategory();
}
if (!this.props.category && nextProps.category){
this.setWindowTitle(nextProps.category);
}
}
setWindowTitle(category = this.props.category){
if (category){
this.props.uiActions.setWindowTitle(category.name);
} else{
this.props.uiActions.setWindowTitle("Genre / Mood");
}
}
@ -107,6 +121,7 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch),
spotifyActions: bindActionCreators(spotifyActions, dispatch)
}
}

View File

@ -22,6 +22,7 @@ class DiscoverFeatured extends React.Component{
}
componentDidMount(){
this.props.uiActions.setWindowTitle("Featured playlists");
if (!this.props.featured_playlists){
this.props.spotifyActions.getFeaturedPlaylists();
}

View File

@ -24,6 +24,8 @@ class DiscoverNewReleases extends React.Component{
}
componentDidMount(){
this.props.uiActions.setWindowTitle("New releases");
if (!this.props.new_releases){
this.props.spotifyActions.getNewReleases();
}

View File

@ -150,6 +150,7 @@ class Discover extends React.Component{
}
componentDidMount(){
this.props.uiActions.setWindowTitle("Discover");
// We have seeds provided in the URL
if (this.props.params.seeds){