Window title reflects current view; Hosted-instance tracking
This commit is contained in:
@ -12,6 +12,7 @@ import ContextMenuTrigger from '../components/ContextMenuTrigger'
|
||||
import Icon from '../components/Icon'
|
||||
|
||||
import * as helpers from '../helpers'
|
||||
import * as uiActions from '../services/ui/actions'
|
||||
import * as mopidyActions from '../services/mopidy/actions'
|
||||
import * as spotifyActions from '../services/spotify/actions'
|
||||
|
||||
@ -22,6 +23,7 @@ class User extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.setWindowTitle();
|
||||
this.loadUser();
|
||||
}
|
||||
|
||||
@ -29,6 +31,18 @@ class User extends React.Component{
|
||||
if (nextProps.params.uri != this.props.params.uri){
|
||||
this.loadUser(nextProps);
|
||||
}
|
||||
|
||||
if (!this.props.user && nextProps.user){
|
||||
this.setWindowTitle(nextProps.user);
|
||||
}
|
||||
}
|
||||
|
||||
setWindowTitle(user = this.props.user){
|
||||
if (user){
|
||||
this.props.uiActions.setWindowTitle(user.name+" (user)");
|
||||
} else{
|
||||
this.props.uiActions.setWindowTitle("User");
|
||||
}
|
||||
}
|
||||
|
||||
loadUser(props = this.props){
|
||||
@ -129,6 +143,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
uiActions: bindActionCreators(uiActions, dispatch),
|
||||
spotifyActions: bindActionCreators(spotifyActions, dispatch)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user