fix: bug fixes

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2021-04-10 16:22:37 +01:00
parent e3a482614c
commit dad43e969f
8 changed files with 36 additions and 17 deletions

View File

@@ -86,7 +86,7 @@ export default class Widgets extends React.PureComponent {
<div id='widgets'>
{this.enabled('searchBar') ? <Search/> : null}
{elements}
{this.enabled('weatherEnabled') ? <Weather/> : null}
{this.enabled('weatherEnabled') && (localStorage.getItem('offlineMode') === 'false') ? <Weather/> : null}
</div>
);
}

View File

@@ -82,12 +82,14 @@ export default class Background extends React.PureComponent {
// Main background getting function
async getBackground() {
if (localStorage.getItem('offlineMode') === 'true') {
return this.offlineBackground();
}
const offline = (localStorage.getItem('offlineMode') === 'true');
switch (localStorage.getItem('backgroundType')) {
case 'api':
if (offline) {
return this.offlineBackground();
}
// favourite button
const favourited = JSON.parse(localStorage.getItem('favourite'));
if (favourited) {
@@ -155,6 +157,12 @@ export default class Background extends React.PureComponent {
case 'custom':
// custom user background
const customBackground = localStorage.getItem('customBackground');
// allow users to use offline images
if (offline && !customBackground.startsWith('data:')) {
return this.offlineBackground();
}
if (customBackground !== '') {
// video background
if (customBackground.endsWith('.mp4') || customBackground.endsWith('.webm') || customBackground.endsWith('.ogg')) {
@@ -178,6 +186,10 @@ export default class Background extends React.PureComponent {
break;
case 'photo_pack':
if (offline) {
return this.offlineBackground();
}
// photo pack
const photoPack = JSON.parse(localStorage.getItem('photo_packs'));
if (photoPack) {

View File

@@ -139,9 +139,13 @@ export default class Quote extends React.PureComponent {
}
componentDidMount() {
// todo: fix (localStorage.getItem('favouriteQuoteEnabled') === 'false')
let favouriteQuote = '';
if (localStorage.getItem('favouriteQuoteEnabled') === 'true') {
favouriteQuote = localStorage.getItem('favouriteQuote') ? <StarIcon className='copyButton' onClick={() => this.favourite()} /> : <StarIcon2 className='copyButton' onClick={() => this.favourite()} />;
}
this.setState({
favourited: localStorage.getItem('favouriteQuote') ? <StarIcon className='copyButton' onClick={() => this.favourite()} /> : null,
favourited: favouriteQuote,
copy: (localStorage.getItem('copyButton') === 'false') ? null : this.state.copy,
tweet: (localStorage.getItem('tweetButton') === 'false') ? null : this.state.tweet
});

View File

@@ -15,6 +15,9 @@
.quoteauthor {
font-size: 0.9em;
letter-spacing: 0.5px;
svg {
margin-left: 10px;
}
}
.copyButton {