Implemented news page, wrote moderation post
This commit is contained in:
@@ -73,6 +73,7 @@ export default class App extends React.Component {
|
||||
|
||||
<LazyRoute path='/tasklist' component={() => import('./pages/task_list.jsx')} />
|
||||
<LazyRoute path='/patronlist' component={() => import('./pages/patron_list.jsx')} />
|
||||
<LazyRoute path='/news/:postId' component={() => import('./pages/news.jsx')} />
|
||||
|
||||
<LazyRoute path='*' component={() => import('./pages/page_not_found.jsx')} />
|
||||
</Switch>
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import React from 'react';
|
||||
|
||||
//panels
|
||||
import CommonLinks from '../panels/common_links.jsx';
|
||||
import NewsPanel from '../panels/news.jsx';
|
||||
|
||||
class News extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
warning: '', //TODO: unified warning?
|
||||
fetch: null
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
this.state.fetch();
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
<NewsPanel
|
||||
setWarning={this.setWarning.bind(this)}
|
||||
getFetch={ (fn) => this.setState({ fetch: fn }) }
|
||||
postId={this.props.match.params.postId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
setWarning(s) {
|
||||
this.setState({ warning: s });
|
||||
}
|
||||
};
|
||||
|
||||
export default News;
|
||||
@@ -31,7 +31,10 @@ class Signup extends React.Component {
|
||||
<div className='page constrained'>
|
||||
<Panel />
|
||||
<Link to='/' className='centered'>Return Home</Link>
|
||||
<div className='break' />
|
||||
<p className='centered'>Remember to verify your email!</p>
|
||||
<div className='break' />
|
||||
<p className='centered'>See the recent news post on<br /><Link to='/news/2019-06-05-01.md'>Moderation Of Usernames</Link>.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class News extends React.Component {
|
||||
};
|
||||
|
||||
if (props.getFetch) {
|
||||
props.getFetch( () => this.sendRequest('/newsrequest', {length: this.props.length || 10}) );
|
||||
props.getFetch( () => this.sendRequest('/newsrequest', {length: this.props.length || 10, postId: this.props.postId}) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user