feat: implement sponsors list on about page

This commit is contained in:
David Ralph 2021-03-18 13:41:42 +00:00
parent 07c9e62205
commit f54fd5adb7
3 changed files with 12 additions and 4 deletions

View File

@ -11,13 +11,15 @@ export default class About extends React.PureComponent {
super(...args);
this.state = {
contributors: [],
update: ''
sponsors: [],
update: this.props.language.version.checking_update
}
}
async getGitHubData() {
const contributors = await (await fetch('https://api.github.com/repos/mue/mue/contributors')).json();
const versionData = await (await fetch('https://api.github.com/repos/mue/mue/releases')).json();
const { sponsors } = await (await fetch(Constants.SPONSORS_URL + '/list')).json();
let updateMsg = this.props.language.version.no_update;
let version = versionData[0].tag_name;
@ -25,9 +27,9 @@ export default class About extends React.PureComponent {
updateMsg = `${this.props.language.version.update_available}: ${version}`;
}
// TODO: REMOVE BOTS AND MAKE IT ACTUALLY WORK
this.setState({
contributors: contributors,
contributors: contributors.filter((contributor) => !contributor.login.includes('bot')),
sponsors: sponsors,
update: updateMsg
});
}
@ -59,7 +61,11 @@ export default class About extends React.PureComponent {
</Tooltip>
)}
<h3>{this.props.language.supporters}</h3>
<p>to be implemented</p>
{this.state.sponsors.map((item) =>
<Tooltip title={item.handle} placement='top' key={item.handle}>
<a href={item.profile} target='_blank' rel='noopener noreferrer'><img draggable='false' className='abouticon' src={item.avatar + '&size=256'} alt={item.handle}></img></a>
</Tooltip>
)}
</div>
);
}

View File

@ -2,6 +2,7 @@ export const API_URL = 'https://api.muetab.com';
export const UNSPLASH_URL = 'https://unsplash.muetab.com';
export const MARKETPLACE_URL = 'https://marketplace.muetab.com';
export const WEBSITE_URL = 'https://muetab.com';
export const SPONSORS_URL = 'https://muesponsors.vercel.app'; // todo: make sponsors.muetab.com work
export const OFFLINE_IMAGES = 20;
export const BETA_VERSION = false;
export const VERSION = '5.0.0';

View File

@ -122,6 +122,7 @@
"copyright": "Copyright",
"version": {
"title": "Version",
"checking_update": "Checking for update",
"update_available": "Update available",
"no_update": "No update available"
},