mirror of
https://github.com/mue/mue.git
synced 2026-07-21 07:54:13 +02:00
Progress, crediting Pexels etc
This commit is contained in:
@@ -11,9 +11,94 @@ export default class Background extends React.Component {
|
||||
document.getElementById('photographer').innerText = `Photo by ${data.photographer}`;
|
||||
document.getElementById('location').innerText = `${data.location}`;
|
||||
} catch (e) { // ..and if that fails we load one locally
|
||||
let photographer;
|
||||
const photo = Math.floor(Math.random() * (20 - 1 + 1)) + 1; // There are 20 images in the offline-images folder
|
||||
document.getElementById('backgroundCredits').style.display = 'none';
|
||||
document.getElementById('photographer').innerText = 'Photo from Pexels';
|
||||
document.getElementById('root').style.backgroundImage = `url(../offline-images/${Math.floor(Math.random() * (20 - 1 + 1)) + 1})`; // There are 20 images in the offline-images folder
|
||||
// eslint-disable-next-line default-case
|
||||
switch (photo) { // Select photographer based on image file number
|
||||
case 1: {
|
||||
photographer = 'Tirachard Kumtanom (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
photographer = 'Sohail Na (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
photographer = 'Miriam Espacio (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 9: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 10: {
|
||||
photographer = 'NO NAME (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 11: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 12: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 13: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 14: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 15: {
|
||||
photographer = 'Pixabay (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 17: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 19: {
|
||||
photographer = 'Unknown (Pexels)';
|
||||
break;
|
||||
}
|
||||
case 20: {
|
||||
photographer = 'Fabian Wiktor (Pexels)';
|
||||
break;
|
||||
}
|
||||
}
|
||||
document.getElementById('photographer').innerText = `Photo by ${photographer}`;
|
||||
document.getElementById('root').style.backgroundImage = `url(../offline-images/${photo}.jpeg)`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import RoomIcon from '@material-ui/icons/Room';
|
||||
import React from 'react';
|
||||
|
||||
export default class Search extends React.Component {
|
||||
export default class Credit extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className='credits'>
|
||||
|
||||
@@ -23,9 +23,10 @@ export default class Greeting extends React.Component {
|
||||
if (t.getMonth() === 0 && t.getDate() === 1) g = 'Happy new year'; // If the date is January 1st, set it to new year
|
||||
else if (t.getMonth() === 11 && t.getDate() === 25) g = 'Merry Christmas'; // If it's December 25th, set it to xmas
|
||||
else if (t.getMonth() === 9 && t.getDate() === 31) g = 'Happy Halloween'; // If it's October 31st, set it to halloween
|
||||
|
||||
this.setState({
|
||||
greeting: g
|
||||
}); // Set the state to the time string
|
||||
}); // Set the state to the greeting string
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//* Imports
|
||||
import React from 'react';
|
||||
import quotes from '../quotes.json';
|
||||
import Quotes from '@muetab/quotes';
|
||||
|
||||
export default class Quote extends React.Component {
|
||||
constructor(...args) {
|
||||
@@ -15,9 +15,12 @@ export default class Quote extends React.Component {
|
||||
try { // First we try and get a quote from the API...
|
||||
let data = await fetch('https://api.muetab.xyz/getQuote');
|
||||
data = await data.json();
|
||||
this.setState({ quote: data.quote, author: data.author });
|
||||
this.setState({
|
||||
quote: data.quote,
|
||||
author: data.author
|
||||
});
|
||||
} catch (e) { // ..and if that fails we load one locally
|
||||
const quote = quotes[Math.floor(Math.random() * quotes.length)]; // Get a random quote from quotes.json
|
||||
const quote = Quotes.random(); // Get a random quote from our local package
|
||||
this.setState({
|
||||
quote: quote.quote,
|
||||
author: quote.author
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
[
|
||||
{
|
||||
"author": "Robert De Niro",
|
||||
"quote": "Time goes on. So whatever you’re going to do, do it. Do it now. Don’t wait."
|
||||
},
|
||||
{
|
||||
"author": "Walt Disney",
|
||||
"quote": "All our dreams can come true, if we have the courage to pursue them."
|
||||
},
|
||||
{
|
||||
"author": "Confucius",
|
||||
"quote": "It does not matter how slowly you go as long as you do not stop."
|
||||
}, {
|
||||
"author": "Roy T. Bennett",
|
||||
"quote": "Believe in yourself. You are braver than you think, more talented than you know, and capable of more than you imagine."
|
||||
}, {
|
||||
"author": "Wayne Dyer",
|
||||
"quote": "If you believe it will work out, you’ll see opportunities. If you believe it won’t, you will see obstacles."
|
||||
}, {
|
||||
"author": "George Addair",
|
||||
"quote": "Everything you’ve ever wanted is on the other side of fear."
|
||||
}, {
|
||||
"author": "Winston Churchill",
|
||||
"quote": "Success is not final, failure is not fatal: it is the courage to continue that counts."
|
||||
}, {
|
||||
"author": "Paulo Coelho",
|
||||
"quote": "There is only one thing that makes a dream impossible to achieve: the fear of failure"
|
||||
}, {
|
||||
"author": "Brian Tracy",
|
||||
"quote": "Your true success in life begins only when you make the commitment to become excellent at what you do."
|
||||
}, {
|
||||
"author": "Chantal Sutherland",
|
||||
"quote": "Believe in yourself, take on your challenges, dig deep within yourself to conquer fears. Never let anyone bring you down. You got to keep going."
|
||||
}, {
|
||||
"author": "Les Brown",
|
||||
"quote": "Too many of us are not living our dreams because we are living our fears."
|
||||
}, {
|
||||
"author": "Bob Riley",
|
||||
"quote": "Hard times don’t create heroes. It is during the hard times when the ‘hero’ within us is revealed."
|
||||
}, {
|
||||
"author": "Jack Canfield",
|
||||
"quote": "If you can tune into your purpose and really align with it, setting goals so that your vision is an expression of that purpose, then life flows much more easily."
|
||||
}, {
|
||||
"author": "Napolean Hill",
|
||||
"quote": "Whatever the mind can conceive and believe, it can achieve."
|
||||
}, {
|
||||
"author": "Jim Rohn",
|
||||
"quote": "Don’t wish it were easier. Wish you were better."
|
||||
}, {
|
||||
"author": "Serena Williams",
|
||||
"quote": "A champion is defined not by their wins but by how they can recover when they fall."
|
||||
}, {
|
||||
"author": "Sheryl Sandberg",
|
||||
"quote": "Motivation comes from working on things we care about."
|
||||
}, {
|
||||
"author": "Reese Witherspoon",
|
||||
"quote": "With the right kind of coaching and determination you can accomplish anything."
|
||||
}, {
|
||||
"author": "Hazrat Inayat Khan",
|
||||
"quote": "Some people look for a beautiful place. Others make a place beautiful."
|
||||
}, {
|
||||
"author": "Albert Einstein",
|
||||
"quote": "Life is like riding a bicycle. To keep your balance, you must keep moving."
|
||||
}, {
|
||||
"author": "Walt Disney",
|
||||
"quote": "The way to get started is to quit talking and begin doing."
|
||||
}, {
|
||||
"author": "Winston Churchill",
|
||||
"quote": "A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty."
|
||||
}, {
|
||||
"author": "Will Rogers",
|
||||
"quote": "Don't let yesterday take up too much of today."
|
||||
}, {
|
||||
"author": "Vince Lombardi",
|
||||
"quote": "It's not whether you get knocked down, it's whether you get up."
|
||||
}, {
|
||||
"author": "Steve Jobs",
|
||||
"quote": "If you are working on something that you really care about, you don’t have to be pushed. The vision pulls you."
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user