2021-02-27 13:46:41 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
|
|
|
2021-03-20 12:55:20 +00:00
|
|
|
const other_contributors = require('../../../../../modules/other_contributors.json');
|
2021-02-28 16:18:17 +00:00
|
|
|
|
2021-02-27 13:46:41 +00:00
|
|
|
export default class About extends React.PureComponent {
|
2021-03-23 13:10:34 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
2021-02-27 13:46:41 +00:00
|
|
|
this.state = {
|
2021-02-27 18:54:29 +00:00
|
|
|
contributors: [],
|
2021-03-18 13:41:42 +00:00
|
|
|
sponsors: [],
|
2021-03-19 20:18:57 +00:00
|
|
|
other_contributors: [],
|
2021-03-31 21:11:53 +00:00
|
|
|
photographers: [],
|
2021-03-26 22:16:44 +00:00
|
|
|
update: window.language.modals.main.settings.sections.about.version.checking_update,
|
2021-03-31 21:11:53 +00:00
|
|
|
loading: window.language.modals.main.loading
|
2021-02-27 13:46:41 +00:00
|
|
|
}
|
2021-03-19 22:30:29 +00:00
|
|
|
this.language = window.language.modals.main.settings.sections.about;
|
2021-02-27 13:46:41 +00:00
|
|
|
}
|
|
|
|
|
2021-02-27 18:54:29 +00:00
|
|
|
async getGitHubData() {
|
2021-03-31 21:11:53 +00:00
|
|
|
let contributors, sponsors, photographers, versionData;
|
2021-03-31 11:21:37 +00:00
|
|
|
try {
|
|
|
|
contributors = await (await fetch(window.constants.GITHUB_URL + '/repos/mue/mue/contributors')).json();
|
|
|
|
sponsors = (await (await fetch(window.constants.SPONSORS_URL + '/list')).json()).sponsors;
|
2021-03-31 21:11:53 +00:00
|
|
|
photographers = await (await fetch(window.constants.API_URL + '/getPhotographers')).json();
|
2021-03-31 11:21:37 +00:00
|
|
|
|
|
|
|
versionData = await (await fetch(window.constants.GITHUB_URL + '/repos/mue/mue/releases')).json();
|
|
|
|
} catch (e) {
|
|
|
|
return this.setState({
|
|
|
|
update: 'Failed to get update information',
|
|
|
|
loading: 'An error occurred'
|
|
|
|
});
|
|
|
|
}
|
2021-02-27 18:54:29 +00:00
|
|
|
|
2021-03-19 20:18:57 +00:00
|
|
|
const newVersion = versionData[0].tag_name;
|
2021-03-18 15:37:58 +00:00
|
|
|
|
2021-03-19 22:30:29 +00:00
|
|
|
let updateMsg = this.language.version.no_update;
|
2021-03-20 19:45:49 +00:00
|
|
|
if (Number(window.constants.VERSION) < newVersion) {
|
2021-03-19 22:30:29 +00:00
|
|
|
updateMsg = `${this.language.version.update_available}: ${newVersion}`;
|
2021-02-27 18:54:29 +00:00
|
|
|
}
|
2021-02-27 13:46:41 +00:00
|
|
|
|
2021-03-17 13:01:53 +00:00
|
|
|
this.setState({
|
2021-03-18 13:41:42 +00:00
|
|
|
contributors: contributors.filter((contributor) => !contributor.login.includes('bot')),
|
|
|
|
sponsors: sponsors,
|
2021-03-19 20:18:57 +00:00
|
|
|
update: updateMsg,
|
2021-03-26 22:16:44 +00:00
|
|
|
other_contributors: other_contributors,
|
2021-04-01 14:12:03 +00:00
|
|
|
photographers: photographers.sort().join(', '),
|
2021-03-26 22:16:44 +00:00
|
|
|
loading: null
|
2021-02-27 13:46:41 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2021-03-18 16:46:50 +00:00
|
|
|
if (localStorage.getItem('offlineMode') === 'true') {
|
|
|
|
this.setState({
|
2021-03-19 22:30:29 +00:00
|
|
|
update: this.language.version.offline_mode
|
2021-03-18 16:46:50 +00:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-02-27 18:54:29 +00:00
|
|
|
this.getGitHubData();
|
2021-02-27 13:46:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2021-03-22 22:17:52 +00:00
|
|
|
<>
|
2021-03-19 22:30:29 +00:00
|
|
|
<h2>{this.language.title}</h2>
|
2021-03-31 20:54:16 +00:00
|
|
|
<img draggable='false' style={{'height': '100px', 'width': 'auto'}} src='./././icons/logo_horizontal.png' alt='Mue logo'></img>
|
2021-03-19 22:30:29 +00:00
|
|
|
<p>{this.language.copyright} 2018-{new Date().getFullYear()} Mue Tab (BSD-3 License)</p>
|
2021-03-20 15:52:27 +00:00
|
|
|
<p>{this.language.version.title} {window.constants.VERSION} ({this.state.update})</p>
|
2021-03-19 22:30:29 +00:00
|
|
|
<h3>{this.language.resources_used.title}</h3>
|
|
|
|
<p>Pexels ({this.language.resources_used.bg_images})</p>
|
|
|
|
<p>Google ({this.language.resources_used.pin_icon})</p>
|
|
|
|
<p>Undraw ({this.language.resources_used.welcome_img})</p>
|
|
|
|
<h3>{this.language.contributors}</h3>
|
2021-03-26 22:16:44 +00:00
|
|
|
{this.state.loading}
|
2021-04-02 12:24:18 +00:00
|
|
|
{this.state.contributors.map((item) => (
|
2021-03-17 13:01:53 +00:00
|
|
|
<Tooltip title={item.login} placement='top' key={item.login}>
|
2021-04-02 21:27:44 +00:00
|
|
|
<a href={'https://github.com/' + item.login} target='_blank' rel='noopener noreferrer'><img draggable='false' className='abouticon' src={item.avatar_url + '&size=128'} alt={item.login}/></a>
|
2021-03-17 13:01:53 +00:00
|
|
|
</Tooltip>
|
2021-04-02 12:24:18 +00:00
|
|
|
))}
|
2021-03-19 20:18:57 +00:00
|
|
|
{ // for those who contributed without opening a pull request
|
2021-04-02 12:24:18 +00:00
|
|
|
this.state.other_contributors.map((item) => (
|
2021-03-17 13:01:53 +00:00
|
|
|
<Tooltip title={item.login} placement='top' key={item.login}>
|
2021-04-02 21:27:44 +00:00
|
|
|
<a href={'https://github.com/' + item.login} target='_blank' rel='noopener noreferrer'><img draggable='false' className='abouticon' src={item.avatar_url + '&size=128'} alt={item.login}/></a>
|
2021-03-17 13:01:53 +00:00
|
|
|
</Tooltip>
|
2021-04-02 12:24:18 +00:00
|
|
|
))}
|
2021-03-19 22:30:29 +00:00
|
|
|
<h3>{this.language.supporters}</h3>
|
2021-03-26 22:16:44 +00:00
|
|
|
{this.state.loading}
|
2021-04-02 12:24:18 +00:00
|
|
|
{this.state.sponsors.map((item) => (
|
2021-03-18 13:41:42 +00:00
|
|
|
<Tooltip title={item.handle} placement='top' key={item.handle}>
|
2021-03-31 20:54:16 +00:00
|
|
|
<a href={item.profile} target='_blank' rel='noopener noreferrer'><img draggable='false' className='abouticon' src={item.avatar + '&size=128'} alt={item.handle}></img></a>
|
2021-03-18 13:41:42 +00:00
|
|
|
</Tooltip>
|
2021-04-02 12:24:18 +00:00
|
|
|
))}
|
2021-03-31 21:11:53 +00:00
|
|
|
<h3>{this.language.photographers}</h3>
|
|
|
|
{this.state.loading}
|
2021-04-01 14:12:03 +00:00
|
|
|
<p>{this.state.photographers}</p>
|
2021-03-22 22:17:52 +00:00
|
|
|
</>
|
2021-02-27 13:46:41 +00:00
|
|
|
);
|
|
|
|
}
|
2021-03-17 13:01:53 +00:00
|
|
|
}
|