Implemented news page, wrote moderation post

This commit is contained in:
2019-06-05 08:02:43 +10:00
parent b5286e1c22
commit 6bbcd03179
9 changed files with 97 additions and 4 deletions
+1
View File
@@ -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>
+53
View File
@@ -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;
+3
View File
@@ -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>
);
}
+1 -1
View File
@@ -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}) );
}
}