import React from 'react'; import Tooltip from '@material-ui/core/Tooltip'; import EmailIcon from '@material-ui/icons/Email'; import TwitterIcon from '@material-ui/icons/Twitter'; import ForumIcon from '@material-ui/icons/Forum'; const other_contributors = require('../../../../../modules/other_contributors.json'); export default class About extends React.PureComponent { constructor() { super(); this.state = { contributors: [], sponsors: [], other_contributors: [], photographers: [], update: window.language.modals.main.settings.sections.about.version.checking_update, loading: window.language.modals.main.loading }; this.language = window.language.modals.main.settings.sections.about; } async getGitHubData() { let contributors, sponsors, photographers, versionData; 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; photographers = await (await fetch(window.constants.API_URL + '/getPhotographers')).json(); 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' }); } const newVersion = versionData[0].tag_name; let updateMsg = this.language.version.no_update; if (Number(window.constants.VERSION) < newVersion) { updateMsg = `${this.language.version.update_available}: ${newVersion}`; } this.setState({ contributors: contributors.filter((contributor) => !contributor.login.includes('bot')), sponsors: sponsors, update: updateMsg, other_contributors: other_contributors, photographers: photographers.sort().join(', '), loading: null }); } componentDidMount() { if (localStorage.getItem('offlineMode') === 'true') { this.setState({ update: this.language.version.offline_mode }); return; } this.getGitHubData(); } render() { return ( <>

{this.language.title}

Mue logo

{this.language.copyright} 2018-{new Date().getFullYear()} Mue Tab (BSD-3 License)

{this.language.version.title} {window.constants.VERSION} ({this.state.update})

{window.language.modals.welcome.support}

{this.language.resources_used.title}

Pexels ({this.language.resources_used.bg_images})

Google ({this.language.resources_used.pin_icon})

Undraw ({this.language.resources_used.welcome_img})

{this.language.contributors}

{this.state.loading} {this.state.contributors.map((item) => ( {item.login}/ ))} { // for those who contributed without opening a pull request this.state.other_contributors.map((item) => ( {item.login}/ ))}

{this.language.supporters}

{this.state.loading} {this.state.sponsors.map((item) => ( {item.handle} ))}

{this.language.photographers}

{this.state.loading}

{this.state.photographers}

); } }