Language as window.language for access in pure function
This commit is contained in:
@ -20,7 +20,7 @@ import {
|
||||
getFromUri,
|
||||
uriType,
|
||||
} from '../util/helpers';
|
||||
import { content } from '../locale';
|
||||
import { content, Content } from '../locale';
|
||||
|
||||
class Queue extends React.Component {
|
||||
constructor(props) {
|
||||
@ -33,15 +33,14 @@ class Queue extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// Restore any limit defined in our location state
|
||||
const state = this.props.location.state ? this.props.location.state : {};
|
||||
if (state.limit) {
|
||||
this.setState({
|
||||
limit: state.limit,
|
||||
});
|
||||
const {
|
||||
uiActions: { setWindowTitle },
|
||||
location: { limit } = {},
|
||||
} = this.props;
|
||||
if (limit) {
|
||||
this.setState({ limit });
|
||||
}
|
||||
|
||||
this.props.uiActions.setWindowTitle('Now playing');
|
||||
setWindowTitle(content('now_playing.title'));
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
|
||||
@ -20,6 +20,7 @@ import * as mopidyActions from '../services/mopidy/actions';
|
||||
import * as lastfmActions from '../services/lastfm/actions';
|
||||
import * as spotifyActions from '../services/spotify/actions';
|
||||
import { isHosted } from '../util/helpers';
|
||||
import { content } from '../locale';
|
||||
|
||||
class Settings extends React.Component {
|
||||
constructor(props) {
|
||||
@ -35,7 +36,8 @@ class Settings extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.uiActions.setWindowTitle('Settings');
|
||||
const { uiActions: { setWindowTitle } } = this.props;
|
||||
setWindowTitle(content('settings.title'));
|
||||
}
|
||||
|
||||
componentDidUpdate = () => {
|
||||
@ -51,8 +53,8 @@ class Settings extends React.Component {
|
||||
}
|
||||
|
||||
onLanguageChange = (language) => {
|
||||
const { uiActions: { set } } = this.props;
|
||||
set({ language });
|
||||
const { uiActions: { setLanguage } } = this.props;
|
||||
setLanguage(language);
|
||||
}
|
||||
|
||||
resetAllSettings() {
|
||||
|
||||
Reference in New Issue
Block a user