2021-08-14 19:10:48 +00:00
|
|
|
import { PureComponent } from 'react';
|
2021-08-15 21:28:37 +00:00
|
|
|
import { Email, Twitter, Chat, Instagram, Facebook } from '@material-ui/icons';
|
2021-02-27 13:46:41 +00:00
|
|
|
|
2021-04-21 13:52:05 +00:00
|
|
|
import Tooltip from '../../../../helpers/tooltip/Tooltip';
|
2021-02-27 13:46:41 +00:00
|
|
|
|
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-08-14 19:10:48 +00:00
|
|
|
export default class About extends 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-05-07 12:27:28 +00:00
|
|
|
photographers: window.language.modals.main.loading,
|
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-04-08 18:52:17 +00:00
|
|
|
};
|
2021-03-19 22:30:29 +00:00
|
|
|
this.language = window.language.modals.main.settings.sections.about;
|
2021-04-18 17:17:04 +00:00
|
|
|
this.controller = new AbortController();
|
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-06-16 11:05:03 +00:00
|
|
|
|
2021-03-31 11:21:37 +00:00
|
|
|
try {
|
2021-07-18 11:20:35 +00:00
|
|
|
versionData = await (await fetch(window.constants.GITHUB_URL + '/repos/' + window.constants.ORG_NAME + '/' + window.constants.REPO_NAME + '/releases', { signal: this.controller.signal })).json();
|
2021-06-20 12:09:41 +00:00
|
|
|
|
2021-07-18 11:20:35 +00:00
|
|
|
contributors = await (await fetch(window.constants.GITHUB_URL + '/repos/'+ window.constants.ORG_NAME + '/' + window.constants.REPO_NAME + '/contributors', { signal: this.controller.signal })).json();
|
2021-04-18 17:17:04 +00:00
|
|
|
sponsors = (await (await fetch(window.constants.SPONSORS_URL + '/list', { signal: this.controller.signal })).json()).sponsors;
|
2021-06-20 12:09:41 +00:00
|
|
|
|
2021-04-18 17:17:04 +00:00
|
|
|
photographers = await (await fetch(window.constants.API_URL + '/images/photographers', { signal: this.controller.signal })).json();
|
2021-03-31 11:21:37 +00:00
|
|
|
} catch (e) {
|
2021-04-18 17:17:04 +00:00
|
|
|
if (this.controller.signal.aborted === true) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-31 11:21:37 +00:00
|
|
|
return this.setState({
|
2021-04-27 21:17:36 +00:00
|
|
|
update: this.language.version.error.title,
|
|
|
|
loading: this.language.version.error.description
|
2021-03-31 11:21:37 +00:00
|
|
|
});
|
|
|
|
}
|
2021-02-27 18:54:29 +00:00
|
|
|
|
2021-04-18 19:51:33 +00:00
|
|
|
if (this.controller.signal.aborted === true) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-03-19 20:18:57 +00:00
|
|
|
const newVersion = versionData[0].tag_name;
|
2021-03-18 15:37:58 +00:00
|
|
|
|
2021-08-27 18:42:40 +00:00
|
|
|
let update = this.language.version.no_update;
|
2021-04-30 17:58:58 +00:00
|
|
|
if (Number(window.constants.VERSION.replaceAll('.', '')) < Number(newVersion.replaceAll('.', ''))) {
|
2021-08-27 18:42:40 +00:00
|
|
|
update = `${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-07-15 16:39:38 +00:00
|
|
|
// exclude bots
|
2021-03-18 13:41:42 +00:00
|
|
|
contributors: contributors.filter((contributor) => !contributor.login.includes('bot')),
|
2021-08-27 18:42:40 +00:00
|
|
|
sponsors,
|
|
|
|
update,
|
|
|
|
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-04-21 18:35:33 +00:00
|
|
|
if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') {
|
2021-03-18 16:46:50 +00:00
|
|
|
this.setState({
|
2021-04-27 21:17:36 +00:00
|
|
|
update: this.language.version.offline_mode,
|
2021-04-28 13:25:24 +00:00
|
|
|
loading: window.language.modals.main.marketplace.offline.description
|
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
|
|
|
}
|
|
|
|
|
2021-04-18 17:17:04 +00:00
|
|
|
componentWillUnmount() {
|
|
|
|
// stop making requests
|
|
|
|
this.controller.abort();
|
|
|
|
}
|
|
|
|
|
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-07-15 16:39:38 +00:00
|
|
|
<img draggable='false' className='aboutLogo' src='./././icons/logo_horizontal.png' alt='Logo'></img>
|
2021-07-29 13:18:21 +00:00
|
|
|
<p>{this.language.copyright} {window.constants.COPYRIGHT_YEAR}-{new Date().getFullYear()} <a href={'https://github.com/' + window.constants.ORG_NAME + '/' + window.constants.REPO_NAME + '/graphs/contributors'} className='aboutLink' target='_blank' rel='noopener noreferrer'>{window.constants.COPYRIGHT_NAME}</a> ({window.constants.COPYRIGHT_LICENSE})</p>
|
2021-03-20 15:52:27 +00:00
|
|
|
<p>{this.language.version.title} {window.constants.VERSION} ({this.state.update})</p>
|
2021-07-18 20:53:35 +00:00
|
|
|
<a href={window.constants.PRIVACY_URL} className='aboutLink' target='_blank' rel='noopener noreferrer' style={{ fontSize: '1rem' }}>{window.language.modals.welcome.sections.privacy.links.privacy_policy}</a>
|
2021-04-07 21:19:46 +00:00
|
|
|
|
2021-04-15 16:15:57 +00:00
|
|
|
<h3>{this.language.contact_us}</h3>
|
2021-08-15 21:28:37 +00:00
|
|
|
<a href={'mailto:' + window.constants.EMAIL} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Email/></a>
|
|
|
|
<a href={'https://twitter.com/' + window.constants.TWITTER_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Twitter/></a>
|
|
|
|
<a href={'https://instagram.com/' + window.constants.INSTAGRAM_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Instagram/></a>
|
|
|
|
<a href={'https://facebook.com/' + window.constants.FACEBOOK_HANDLE} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Facebook/></a>
|
|
|
|
<a href={'https://discord.gg/' + window.constants.DISCORD_SERVER} className='aboutIcon' target='_blank' rel='noopener noreferrer'><Chat/></a>
|
2021-04-07 21:19:46 +00:00
|
|
|
|
2021-04-15 16:15:57 +00:00
|
|
|
<h3>{this.language.support_mue}</h3>
|
2021-05-22 21:56:24 +00:00
|
|
|
<p>
|
2021-07-15 16:39:38 +00:00
|
|
|
<a href={'https://github.com/sponsors/' + window.constants.DONATE_USERNAME} className='aboutLink' target='_blank' rel='noopener noreferrer'>GitHub Sponsors</a>
|
|
|
|
• <a href={'https://ko-fi.com/' + window.constants.DONATE_USERNAME} className='aboutLink' target='_blank' rel='noopener noreferrer'>Ko-Fi</a>
|
|
|
|
• <a href={'https://patreon.com/' + window.constants.DONATE_USERNAME} className='aboutLink' target='_blank' rel='noopener noreferrer'>Patreon</a>
|
2021-05-22 21:56:24 +00:00
|
|
|
</p>
|
2021-04-15 16:15:57 +00:00
|
|
|
|
2021-03-19 22:30:29 +00:00
|
|
|
<h3>{this.language.resources_used.title}</h3>
|
2021-05-22 21:56:24 +00:00
|
|
|
<p>
|
|
|
|
<a href='https://www.pexels.com' className='aboutLink' target='_blank' rel='noopener noreferrer'>Pexels</a>
|
|
|
|
, <a href='https://unsplash.com' className='aboutLink' target='_blank' rel='noopener noreferrer'>Unsplash</a> ({this.language.resources_used.bg_images})
|
|
|
|
</p>
|
2021-05-06 17:30:57 +00:00
|
|
|
<p><a href='https://fonts.google.com/icons?selected=Material+Icons' className='aboutLink' target='_blank' rel='noopener noreferrer'>Google Fonts</a> ({this.language.resources_used.pin_icon})</p>
|
2021-05-07 12:27:28 +00:00
|
|
|
<p><a href='https://undraw.co' className='aboutLink' target='_blank' rel='noopener noreferrer'>Undraw</a> ({this.language.resources_used.welcome_img})</p>
|
2021-04-07 21:19:46 +00:00
|
|
|
|
2021-03-19 22:30:29 +00:00
|
|
|
<h3>{this.language.contributors}</h3>
|
2021-04-17 19:01:24 +00:00
|
|
|
<p>{this.state.loading}</p>
|
2021-04-02 12:24:18 +00:00
|
|
|
{this.state.contributors.map((item) => (
|
2021-04-21 13:52:05 +00:00
|
|
|
<Tooltip title={item.login} 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-04-21 13:52:05 +00:00
|
|
|
<Tooltip title={item.login} 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-04-07 21:19:46 +00:00
|
|
|
|
2021-03-19 22:30:29 +00:00
|
|
|
<h3>{this.language.supporters}</h3>
|
2021-04-17 19:01:24 +00:00
|
|
|
<p>{this.state.loading}</p>
|
2021-04-02 12:24:18 +00:00
|
|
|
{this.state.sponsors.map((item) => (
|
2021-04-21 13:52:05 +00:00
|
|
|
<Tooltip title={item.handle} key={item.handle}>
|
2021-07-15 16:39:38 +00:00
|
|
|
<a href={'https://github.com/' + item.handle} 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-04-07 21:19:46 +00:00
|
|
|
|
2021-03-31 21:11:53 +00:00
|
|
|
<h3>{this.language.photographers}</h3>
|
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
|
|
|
}
|