diff --git a/src/components/modals/main/settings/Radio.jsx b/src/components/modals/main/settings/Radio.jsx index d4b1fdd9..87e5894c 100644 --- a/src/components/modals/main/settings/Radio.jsx +++ b/src/components/modals/main/settings/Radio.jsx @@ -19,7 +19,10 @@ export default class Radio extends PureComponent { } if (this.props.name === 'language') { - localStorage.setItem('tabName', require(`../../../../translations/${value.replace('-', '_')}.json`).tabname); + // old tab name + if (localStorage.getItem('tabName') === window.language.tabname) { + localStorage.setItem('tabName', require(`../../../../translations/${value.replace('-', '_')}.json`).tabname); + } } localStorage.setItem(this.props.name, value); diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index 4e5aa3b6..1a69f7c5 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -82,23 +82,26 @@ export default class Background extends PureComponent { offline = true; } + const setFavourited = (favourited) => { + this.setState({ + url: favourited.url, + photoInfo: { + credit: favourited.credit, + location: favourited.location, + camera: favourited.camera + } + }); + } + switch (localStorage.getItem('backgroundType')) { case 'api': if (offline) { return this.setState(offlineBackground()); } - // favourite button const favourited = JSON.parse(localStorage.getItem('favourite')); if (favourited) { - return this.setState({ - url: favourited.url, - photoInfo: { - credit: favourited.credit, - location: favourited.location, - camera: favourited.camera - } - }); + return setFavourited(favourited); } // API background @@ -205,6 +208,11 @@ export default class Background extends PureComponent { return this.setState(offlineBackground()); } + const photofavourited = JSON.parse(localStorage.getItem('favourite')); + if (photofavourited) { + return setFavourited(photofavourited); + } + const photoPack = JSON.parse(localStorage.getItem('photo_packs')); if (photoPack) { const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)]; diff --git a/src/components/widgets/greeting/Greeting.jsx b/src/components/widgets/greeting/Greeting.jsx index 6a6fcbb0..b1cb7ac8 100644 --- a/src/components/widgets/greeting/Greeting.jsx +++ b/src/components/widgets/greeting/Greeting.jsx @@ -82,12 +82,14 @@ export default class Greeting extends PureComponent { } } - if (custom === 'false') { + const birthday = localStorage.getItem('birthdayenabled'); + + if (custom === 'false' && birthday !== 'true') { name = name.replace(',', ''); } // Birthday - if (localStorage.getItem('birthdayenabled') === 'true') { + if (birthday === 'true') { const birth = new Date(localStorage.getItem('birthday')); if (birth.getDate() === now.getDate() && birth.getMonth() === now.getMonth()) {