overview changes

Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
alexsparkes
2022-09-05 10:13:42 +01:00
parent 68783429d4
commit 517091cbda
5 changed files with 64 additions and 47 deletions

View File

@@ -2,7 +2,7 @@ import variables from 'modules/variables';
import { PureComponent } from 'react';
import { MdEmail, MdContactPage } from 'react-icons/md';
import { FaDiscord, FaTwitter } from 'react-icons/fa';
import { SiGithubsponsors, SiLiberapay, SiKofi, SiPatreon } from 'react-icons/si';
import { SiGithubsponsors, SiOpencollective } from 'react-icons/si';
import { BiDonateHeart } from 'react-icons/bi';
import Tooltip from 'components/helpers/tooltip/Tooltip';
@@ -221,7 +221,10 @@ export default class About extends PureComponent {
</span>
<p>{variables.getMessage('modals.main.settings.sections.about.support_subtitle')}</p>
<div className="aboutContact">
<a className="donateButton" href={variables.constants.DONATE_LINK}>
<a
className="donateButton"
href={'https://opencollective.com/' + variables.constants.OPENCOLLECTIVE_USERNAME}
>
<BiDonateHeart />
{variables.getMessage('modals.main.settings.sections.about.support_donate')}
</a>
@@ -234,31 +237,13 @@ export default class About extends PureComponent {
<SiGithubsponsors />
</a>
</Tooltip>
<Tooltip title={'Liberapay'}>
<Tooltip title={'Open Collective'}>
<a
href={'https://liberapay.com/' + variables.constants.LIBERAPAY_USERNAME}
href={'https://opencollective.com/' + variables.constants.OPENCOLLECTIVE_USERNAME}
target="_blank"
rel="noopener noreferrer"
>
<SiLiberapay />
</a>
</Tooltip>
<Tooltip title={'Ko-Fi'}>
<a
href={'https://ko-fi.com/' + variables.constants.KOFI_USERNAME}
target="_blank"
rel="noopener noreferrer"
>
<SiKofi />
</a>
</Tooltip>
<Tooltip title={'Patreon'}>
<a
href={'https://patreon.com/' + variables.constants.PATREON_USERNAME}
target="_blank"
rel="noopener noreferrer"
>
<SiPatreon />
<SiOpencollective />
</a>
</Tooltip>
</div>

View File

@@ -38,6 +38,14 @@ export default class OrderSettings extends PureComponent {
super();
this.state = {
items: JSON.parse(localStorage.getItem('order')),
news: {
title: '',
date: '',
description: '',
link: '',
linkText: ''
},
newsDone: false
};
}
@@ -96,12 +104,24 @@ export default class OrderSettings extends PureComponent {
}
};
async getNews() {
const data = await (await fetch('https://api.muetab.com/news')).json();
this.setState({
news: data.news,
newsDone: true
});
}
componentDidUpdate() {
localStorage.setItem('order', JSON.stringify(this.state.items));
variables.stats.postEvent('setting', 'Widget order');
EventBus.dispatch('refresh', 'widgets');
}
componentDidMount() {
this.getNews();
}
render() {
return (
<>
@@ -131,6 +151,12 @@ export default class OrderSettings extends PureComponent {
})}
</div>
</div>
<div style={{ display: "flex", flexFlow: "column" }}>
<span className='title'>{this.state.news.title}</span>
<span className='subtitle'>{this.state.news.date}</span>
<span>{this.state.news.description}</span>
<a className='link' href={this.state.news.link}>{this.state.news.linkText}</a>
</div>
</div>
<div>
<span className="title">

View File

@@ -383,7 +383,7 @@ export default class Background extends PureComponent {
return this.setState(JSON.parse(localStorage.getItem('welcomeImage')));
}
if (localStorage.getItem('backgroundchange') === 'refresh') {
if (localStorage.getItem('backgroundchange') === 'refresh' || (localStorage.getItem('quotechange')) === null) {
try {
document.getElementById('backgroundImage').classList.remove('fade-in');
document.getElementsByClassName('photoInformation')[0].classList.remove('fade-in');
@@ -394,6 +394,8 @@ export default class Background extends PureComponent {
localStorage.setItem('backgroundStartTime', Date.now());
}
const test = localStorage.getItem('backgroundchange');
this.interval = setInterval(() => {
const targetTime = Number(
Number(localStorage.getItem('backgroundStartTime')) +
@@ -402,26 +404,28 @@ export default class Background extends PureComponent {
const currentTime = Number(Date.now());
const type = localStorage.getItem('backgroundType');
if (currentTime >= targetTime) {
console.log('Is this true?')
this.getBackground();
localStorage.setItem('backgroundStartTime', Date.now());
} else {
console.log('Or this?')
try {
const current = JSON.parse(localStorage.getItem('currentBackground'));
if (current.type !== type) {
this.getBackground();
}
const offline = localStorage.getItem('offlineMode');
if (current.url.startsWith('http') && offline === 'false') {
if (test !== null) {
if (currentTime >= targetTime) {
console.log('Is this true?');
this.getBackground();
localStorage.setItem('backgroundStartTime', Date.now());
} else {
console.log('Or this?');
try {
const current = JSON.parse(localStorage.getItem('currentBackground'));
if (current.type !== type) {
this.getBackground();
}
const offline = localStorage.getItem('offlineMode');
if (current.url.startsWith('http') && offline === 'false') {
this.setState(current);
} else if (current.url.startsWith('http')) {
this.setState(offlineBackground());
}
this.setState(current);
} else if (current.url.startsWith('http')) {
this.setState(offlineBackground());
} catch (e) {
this.setBackground();
}
this.setState(current);
} catch (e) {
this.setBackground();
}
}
});

View File

@@ -359,13 +359,16 @@ export default class Quote extends PureComponent {
}
});
if (localStorage.getItem('quotechange') === 'refresh') {
if (localStorage.getItem('quotechange') === 'refresh' || (localStorage.getItem('quotechange')) === null ) {
this.setZoom();
this.getQuote();
localStorage.setItem('quoteStartTime', Date.now());
}
const test = localStorage.getItem('quotechange')
this.interval = setInterval(() => {
if (test !== null ) {
const targetTime = Number(
Number(localStorage.getItem('quoteStartTime')) +
Number(localStorage.getItem('quotechange')),
@@ -384,6 +387,7 @@ export default class Quote extends PureComponent {
this.getQuote();
}
}
}
});
}

View File

@@ -31,10 +31,8 @@ export const DISCORD_SERVER = 'zv8C9F8';
export const COPYRIGHT_NAME = 'The Mue Authors';
export const COPYRIGHT_YEAR = '2018';
export const COPYRIGHT_LICENSE = 'BSD-3-Clause License';
export const LIBERAPAY_USERNAME = 'mue';
export const SPONSORS_USERNAME = 'davidcralph';
export const KOFI_USERNAME = 'davidcralph';
export const PATREON_USERNAME = 'davidcralph';
export const OPENCOLLECTIVE_USERNAME = 'mue';
export const SPONSORS_USERNAME = 'mue';
export const OFFLINE_IMAGES = 20;