diff --git a/src/App.jsx b/src/App.jsx index adf60223..6ff641a0 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -10,9 +10,9 @@ import './css/index.css'; //* Functions const getCookie = (cookiename) => { - let cookiestring = RegExp('' + cookiename + '[^;]+').exec(document.cookie); + const cookiestring = RegExp('' + cookiename + '[^;]+').exec(document.cookie); return unescape(!!cookiestring ? cookiestring.toString().replace(/^[^=]+./,'') : ''); -} +}; const randomInt = (min, max) => { return Math.floor(Math.random() * (max - min + 1)) + min; }; @@ -35,12 +35,12 @@ export default class App extends React.Component { // Set background: Attempt to get one from the API first, and if that fails then use the offline ones. async getAndSetBackground() { - let root = document.getElementById('root'); + const root = document.getElementById('root'); try { let data = await Fetch('https://api.muetab.xyz/getImage?category=Outdoors'); data = await data.json(); - let checkRepeat = getCookie('backgroundimageurl'); + const checkRepeat = getCookie('backgroundimageurl'); document.getElementById('photographer').innerText = `Photo by ${data.photographer}`; let location = data.location; if (data.location === 'Lake') location = 'Lake District'; @@ -57,8 +57,7 @@ export default class App extends React.Component { document.cookie = `backgroundimageurl=${data.file}`; } } catch (e) { - console.log(e); - document.getElementById('backgroundCredits').style.display = "none"; + document.getElementById('backgroundCredits').style.display = 'none'; document.getElementById('photographer').innerText = 'Photo from Pexels'; root.style.backgroundImage = `url(../offline-images/${randomInt(1, 25)}.jpeg)`; } diff --git a/src/index.js b/src/index.js index 5241a5da..b2b29fa4 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,6 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App.jsx'; import * as serviceWorker from './serviceWorker'; -//import './i18n.jsx'; ReactDOM.render( , diff --git a/src/modules/Clock.jsx b/src/modules/Clock.jsx index 6bf4dbe1..677ebf0d 100644 --- a/src/modules/Clock.jsx +++ b/src/modules/Clock.jsx @@ -3,7 +3,7 @@ import React from 'react'; const checkTime = (i) => { if (i < 10) i = '0' + i; return i; -} +}; export default class Clock extends React.Component { constructor(...args) { @@ -16,9 +16,9 @@ export default class Clock extends React.Component { startTime() { const today = new Date(); - let h = today.getHours(); - let ampm = h >= 12 ? 'PM' : 'AM'; - const m = checkTime(today.getMinutes()); + let h = today.getHours(); + const ampm = h >= 12 ? 'PM' : 'AM'; + const m = checkTime(today.getMinutes()); // const s = checkTime(today.getSeconds()); if (h > 12) h = h - 12; diff --git a/src/modules/Credit.jsx b/src/modules/Credit.jsx index 0fc102a5..2453ffcb 100644 --- a/src/modules/Credit.jsx +++ b/src/modules/Credit.jsx @@ -10,7 +10,6 @@ export default class Search extends React.Component {

-
); diff --git a/src/modules/Greeting.jsx b/src/modules/Greeting.jsx index a695b2e4..a09735c3 100644 --- a/src/modules/Greeting.jsx +++ b/src/modules/Greeting.jsx @@ -9,9 +9,9 @@ export default class Greeting extends React.Component { } getGreeting() { - const h = new Date().getHours(); - let t = 'Good evening'; // Set the default time string to "Good evening" - if (h < 12) t = 'Good morning'; // If it's before 12am, set the time string to "Good morning" + const h = new Date().getHours(); + let t = 'Good evening'; // Set the default time string to "Good evening" + if (h < 12) t = 'Good morning'; // If it's before 12am, set the time string to "Good morning" else if (h < 18) t = 'Good afternoon'; // If it's before 6pm, set the time string to "Good afternoon" this.setState({ greeting: t }); // Set the state to the time string } diff --git a/src/modules/Quote.jsx b/src/modules/Quote.jsx index 9f5ec4d0..1da4340a 100644 --- a/src/modules/Quote.jsx +++ b/src/modules/Quote.jsx @@ -18,8 +18,8 @@ export default class Quote extends React.Component { this.setState({ quote: data.quote, author: data.author }); } catch (e) { const randomInt = (min, max) => { return Math.floor(Math.random() * (max - min + 1)) + min; }; - const num = randomInt(1, 20); - this.setState({ quote: quotes[num].quote, author: quotes[num].author }) + const num = randomInt(1, 20); + this.setState({ quote: quotes[num].quote, author: quotes[num].author }); } } diff --git a/src/modules/Search.jsx b/src/modules/Search.jsx index 5a836905..f823b7ef 100644 --- a/src/modules/Search.jsx +++ b/src/modules/Search.jsx @@ -6,7 +6,7 @@ export default class Search extends React.Component {