Implemented patron page
This commit is contained in:
@@ -72,6 +72,7 @@ export default class App extends React.Component {
|
||||
<LazyRoute path='/equipment' component={() => import('./pages/equipment.jsx')} />
|
||||
|
||||
<LazyRoute path='/tasklist' component={() => import('./pages/task_list.jsx')} />
|
||||
<LazyRoute path='/patronlist' component={() => import('./pages/patron_list.jsx')} />
|
||||
|
||||
<LazyRoute path='*' component={() => import('./pages/page_not_found.jsx')} />
|
||||
</Switch>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import React from 'react';
|
||||
import ReactMarkdown from 'react-markdown/with-html';
|
||||
|
||||
//panels
|
||||
import CommonLinks from '../panels/common_links.jsx';
|
||||
|
||||
class PatronList extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: '',
|
||||
warning: ''
|
||||
};
|
||||
|
||||
this.sendRequest('/content/patron_list.md');
|
||||
}
|
||||
|
||||
render() {
|
||||
let warningStyle = {
|
||||
display: this.state.warning.length > 0 ? 'flex' : 'none'
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='page'>
|
||||
<div className='sidePanelPage'>
|
||||
<div className='sidePanel'>
|
||||
<CommonLinks />
|
||||
</div>
|
||||
|
||||
<div className='mainPanel'>
|
||||
<div className='warning' style={warningStyle}>
|
||||
<p>{this.state.warning}</p>
|
||||
</div>
|
||||
|
||||
<h1 className='centered'>My Patrons On Patreon</h1>
|
||||
<p className='centered'>You can become a patron <a href='https://www.patreon.com/krgamestudios'>here</a>.</p>
|
||||
{this.state ? <ReactMarkdown source={this.state.data} escapeHtml={false} /> : <p>Loading patron list...</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
sendRequest(url, args = {}) {
|
||||
//build the XHR
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
//on success
|
||||
this.setState({ data: xhr.responseText });
|
||||
}
|
||||
else {
|
||||
this.setWarning(xhr.responseText);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
setWarning(s) {
|
||||
this.setState({ warning: s });
|
||||
}
|
||||
};
|
||||
|
||||
export default PatronList;
|
||||
@@ -35,6 +35,7 @@ class CommonLinks extends React.Component {
|
||||
<p><Link to='/combatlog' onClick={this.props.onClickCombatLog}>Combat Log</Link></p>
|
||||
<p><Link to='/passwordchange' onClick={this.props.onClickPasswordChange}>Change Password</Link></p>
|
||||
<p><Link to='/tasklist' onClick={this.props.onClickTaskList}>Task List</Link></p>
|
||||
<p><Link to='/patronlist' onClick={this.props.onClickTaskList}>Patron List</Link></p>
|
||||
|
||||
<Extra />
|
||||
|
||||
@@ -50,6 +51,7 @@ class CommonLinks extends React.Component {
|
||||
<p><Link to='/passwordrecover' onClick={this.props.onClickPasswordRecover}>Recover Password</Link></p>
|
||||
<p><Link to='/ladder' onClick={this.props.onClickLadder}>Game Ladder</Link></p>
|
||||
<p><Link to='/tasklist' onClick={this.props.onClickTaskList}>Task List</Link></p>
|
||||
<p><Link to='/patronlist' onClick={this.props.onClickTaskList}>Patron List</Link></p>
|
||||
|
||||
<Extra />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user