feat: new changelog tab

This commit is contained in:
David Ralph
2021-04-16 18:43:23 +01:00
parent 6c3b15a8f9
commit 81ae913be1
6 changed files with 56 additions and 33 deletions

View File

@@ -155,7 +155,7 @@ p.description {
background: #2d3436;
}
#item>img {
#item>img, .updateimage, .updatechangelog>p>img {
border-radius: 24px;
height: 200px;
width: auto;

View File

@@ -161,3 +161,17 @@ input[type=color]::-moz-color-swatch {
color: var(--modal-text) !important;
cursor: move;
}
.updatechangelog {
li {
cursor: initial;
font-size: 1rem;
list-style-type:disc;
padding: 0;
margin-left: 20px;
}
}
.aboutLink {
color: var(--modal-text) !important;
}

View File

@@ -78,10 +78,7 @@ export default class About extends React.PureComponent {
<a href='https://discord.gg/zv8C9F8' className='welcomeLink' target='_blank' rel='noopener noreferrer'><ForumIcon/></a>
<h3>{this.language.support_mue}</h3>
<p><a href='https://github.com/sponsors/davidjcralph' className='welcomeLink' target='_blank' rel='noopener noreferrer'>GitHub Sponsors</a>
<a href='https://ko-fi.com/davidjcralph' className='welcomeLink' target='_blank' rel='noopener noreferrer'>Ko-Fi</a>
<a href='https://patreon.com/davidjcralph' className='welcomeLink' target='_blank' rel='noopener noreferrer'>Patreon</a>
</p>
<p><a href='https://github.com/sponsors/davidjcralph' className='aboutLink' target='_blank' rel='noopener noreferrer'>GitHub Sponsors</a> <a href='https://ko-fi.com/davidjcralph' className='aboutLink' target='_blank' rel='noopener noreferrer'>Ko-Fi</a> <a href='https://patreon.com/davidjcralph' className='aboutLink' target='_blank' rel='noopener noreferrer'>Patreon</a></p>
<h3>{this.language.resources_used.title}</h3>
<p>Pexels ({this.language.resources_used.bg_images})</p>

View File

@@ -1,56 +1,67 @@
import React from 'react';
import WifiOffIcon from '@material-ui/icons/WifiOff';
export default class Changelog extends React.PureComponent {
constructor() {
super();
this.state = {
title: window.language.modals.update.title,
date: null,
content: window.language.modals.update.title,
html: window.language.modals.main.loading,
image: null
title: null
};
this.language = window.language.modals.update;
}
async getUpdate() {
const data = await (await fetch(window.constants.API_URL + '/getUpdate')).json();
if (data.statusCode === 500 || data.title === null) {
const supportText = `<br/><p>${this.language.contact_support}: <a target='_blank' class='modalLink' style='padding-left: 0px' href='https://muetab.com/contact'>https://muetab.com/contact</a></p>`;
return this.setState({
title: this.language.error.title,
html: this.language.error.description + supportText
});
}
const data = await (await fetch(window.constants.BLOG_POST + '/index.json')).json();
this.setState({
title: data.title,
date: data.published,
image: data.image || null,
author: data.author,
html: data.content
date: data.date.split(' ')[0],
image: data.featured_image || null,
author: 'By ' + data.author,
html: data.html
});
}
componentDidMount() {
if (localStorage.getItem('offlineMode') === 'true') {
return this.setState({
title: this.language.offline.title,
html: this.language.offline.description
});
return;
}
this.getUpdate();
}
render() {
const errorMessage = (msg) => {
return (
<div className='emptyitems'>
<div className='emptyMessage'>
{msg}
</div>
</div>
);
};
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
const language = window.language.modals.main.marketplace;
return errorMessage(<>
<WifiOffIcon/>
<h1>{language.offline.title}</h1>
<p className='description'>{language.offline.description}</p>
</>);
}
if (!this.state.title) {
return errorMessage(<h1>{window.language.modals.main.loading}</h1>);
}
return (
<>
<h1 style={{ 'marginBottom': '-10px' }}>{this.state.title}</h1>
<h5 style={{ 'lineHeight': '0px' }}>{this.state.date}</h5>
{this.state.image ? <img draggable='false' src={this.state.image} alt={window.language.modals.update.title}/> : null}
<p dangerouslySetInnerHTML={{ __html: this.state.html }}></p>
<h5 style={{ 'lineHeight': '0px' }}>{this.state.author} {this.state.date}</h5>
{this.state.image ? <img draggable='false' src={this.state.image} alt={window.language.modals.update.title} className='updateimage'/> : null}
<div className='updatechangelog' dangerouslySetInnerHTML={{ __html: this.state.html }}/>
</>
);
}

View File

@@ -5,8 +5,9 @@ export const WEATHER_URL = 'https://mueweather.ohlookitsderpy.workers.dev';
export const WEBSITE_URL = 'https://muetab.com';
export const SPONSORS_URL = 'https://sponsors.muetab.com';
export const GITHUB_URL = 'https://api.github.com';
export const BLOG_POST = 'https://blog.muetab.com/posts/mue-marketplace';
export const FEEDBACK_FORM = 'https://api.formcake.com/api/form/349b56cb-7e2b-4004-b32b-e8964d217dd1/submission';
export const DDG_PROXY = 'https://external-content.duckduckgo.com/iu/?u=';
export const OFFLINE_IMAGES = 20;
export const BETA_VERSION = false;
export const VERSION = '5.0';
export const VERSION = '5.0';

View File

@@ -25,7 +25,7 @@
},
{
"name": "brightness",
"value": 100
"value": 90
},
{
"name": "events",