From 2dd0e9150bbe48cd896a3192b49fd414c08202b7 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Mon, 21 Sep 2020 22:23:04 +0100 Subject: [PATCH] More bug fixes --- src/components/widgets/Background.jsx | 10 +++++----- src/components/widgets/Clock.jsx | 2 ++ src/components/widgets/Maximise.jsx | 2 +- src/scss/modules/_settings.scss | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/widgets/Background.jsx b/src/components/widgets/Background.jsx index 0c1176ea..dd4461cf 100644 --- a/src/components/widgets/Background.jsx +++ b/src/components/widgets/Background.jsx @@ -43,17 +43,17 @@ export default class Background extends React.PureComponent { const customBackground = localStorage.getItem('customBackground'); const favourited = JSON.parse(localStorage.getItem('favourite')); - if (photoPack) { + if (favourited) { + this.setBackground(favourited.url, null, 'true'); + this.setCredit(favourited.credit); + document.getElementById('location').textContent = favourited.location; + } else if (photoPack) { const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)]; this.setBackground(randomPhoto.url.default, null, randomPhoto.photographer); this.setCredit(randomPhoto.photographer); document.getElementById('location').textContent = randomPhoto.location; } else if (customBackgroundColour) { this.setBackground(null, customBackgroundColour, 'false'); - } else if (favourited) { - this.setBackground(favourited.url, null, 'true'); - this.setCredit(favourited.credit); - document.getElementById('location').textContent = favourited.location; } else if (customBackground !== '') { // Local this.setBackground(customBackground, null, 'false'); } else { // Online diff --git a/src/components/widgets/Clock.jsx b/src/components/widgets/Clock.jsx index fde01b1d..22bff396 100644 --- a/src/components/widgets/Clock.jsx +++ b/src/components/widgets/Clock.jsx @@ -35,6 +35,7 @@ export default class Clock extends React.PureComponent { if (localStorage.getItem('24hour') === 'true') { let time = ''; if (zero === 'false') time = `${now.getHours()}:${now.getMinutes()}${sec}`; + else time = `${('00' + now.getHours()).slice(-2)}:${('00' + now.getMinutes()).slice(-2)}${sec}`; this.setState({ time: time @@ -51,6 +52,7 @@ export default class Clock extends React.PureComponent { let time = ''; if (zero === 'false') time = `${hours}:${now.getMinutes()}${sec}`; else time = `${('00' + hours).slice(-2)}:${('00' + now.getMinutes()).slice(-2)}${sec}`; + this.setState({ time: time, ampm: ampm diff --git a/src/components/widgets/Maximise.jsx b/src/components/widgets/Maximise.jsx index 8e61c059..419de656 100644 --- a/src/components/widgets/Maximise.jsx +++ b/src/components/widgets/Maximise.jsx @@ -19,7 +19,7 @@ export default class View extends React.PureComponent { } viewStuff() { - const elements = ['#searchBar', '.navbar-container', '.clock', '.greeting', '.quotediv']; + const elements = ['#searchBar', '.navbar-container', '.clock', '.greeting', '.quotediv', 'time']; elements.forEach((element) => { try { (this.state.hidden === false) ? document.querySelector(element).style.display = 'none' : document.querySelector(element).style.display = 'block'; diff --git a/src/scss/modules/_settings.scss b/src/scss/modules/_settings.scss index 3f5f2928..d36b1e7c 100644 --- a/src/scss/modules/_settings.scss +++ b/src/scss/modules/_settings.scss @@ -206,4 +206,8 @@ select { select#language { float: right; +} + +#customBackgroundColour { + cursor: pointer; } \ No newline at end of file