|
@@ -9,6 +9,7 @@ interface IProps {
|
|
categories: Category[];
|
|
categories: Category[];
|
|
threads: Thread[];
|
|
threads: Thread[];
|
|
handles: Handles;
|
|
handles: Handles;
|
|
|
|
+ now: number;
|
|
}
|
|
}
|
|
interface IState {
|
|
interface IState {
|
|
categoryId: number;
|
|
categoryId: number;
|
|
@@ -22,7 +23,6 @@ class Forum extends React.Component<IProps, IState> {
|
|
this.state = { categoryId: 0, threadId: 0, postId: 0 };
|
|
this.state = { categoryId: 0, threadId: 0, postId: 0 };
|
|
this.selectCategory = this.selectCategory.bind(this);
|
|
this.selectCategory = this.selectCategory.bind(this);
|
|
this.selectThread = this.selectThread.bind(this);
|
|
this.selectThread = this.selectThread.bind(this);
|
|
- this.selectPost = this.selectPost.bind(this);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
selectCategory(categoryId: number) {
|
|
selectCategory(categoryId: number) {
|
|
@@ -31,9 +31,6 @@ class Forum extends React.Component<IProps, IState> {
|
|
selectThread(threadId: number) {
|
|
selectThread(threadId: number) {
|
|
this.setState({ threadId });
|
|
this.setState({ threadId });
|
|
}
|
|
}
|
|
- selectPost(postId: number) {
|
|
|
|
- this.setState({ postId });
|
|
|
|
- }
|
|
|
|
|
|
|
|
getMinimal(array: { id: number }[]) {
|
|
getMinimal(array: { id: number }[]) {
|
|
if (!array.length) return `all`;
|
|
if (!array.length) return `all`;
|
|
@@ -45,8 +42,10 @@ class Forum extends React.Component<IProps, IState> {
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
render() {
|
|
- const { handles, categories, posts, threads } = this.props;
|
|
|
|
- const { categoryId, threadId, postId } = this.state;
|
|
|
|
|
|
+ const { block, now, handles, categories, posts, threads } = this.props;
|
|
|
|
+ const { categoryId, threadId } = this.state;
|
|
|
|
+
|
|
|
|
+ const startTime: number = now - block * 6000;
|
|
|
|
|
|
const category = categoryId
|
|
const category = categoryId
|
|
? categories.find((c) => c.id === categoryId)
|
|
? categories.find((c) => c.id === categoryId)
|
|
@@ -54,14 +53,12 @@ class Forum extends React.Component<IProps, IState> {
|
|
const thread = threadId
|
|
const thread = threadId
|
|
? threads.find((t) => t.id === threadId)
|
|
? threads.find((t) => t.id === threadId)
|
|
: undefined;
|
|
: undefined;
|
|
- const post = postId ? posts.find((p) => p.id === postId) : undefined;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
<div className="h-100 overflow-hidden bg-dark">
|
|
<div className="h-100 overflow-hidden bg-dark">
|
|
<NavBar
|
|
<NavBar
|
|
selectCategory={this.selectCategory}
|
|
selectCategory={this.selectCategory}
|
|
selectThread={this.selectThread}
|
|
selectThread={this.selectThread}
|
|
- selectPost={this.selectPost}
|
|
|
|
getMinimal={this.getMinimal}
|
|
getMinimal={this.getMinimal}
|
|
categories={categories}
|
|
categories={categories}
|
|
category={category}
|
|
category={category}
|
|
@@ -72,14 +69,13 @@ class Forum extends React.Component<IProps, IState> {
|
|
<Content
|
|
<Content
|
|
selectCategory={this.selectCategory}
|
|
selectCategory={this.selectCategory}
|
|
selectThread={this.selectThread}
|
|
selectThread={this.selectThread}
|
|
- selectPost={this.selectPost}
|
|
|
|
categories={categories}
|
|
categories={categories}
|
|
threads={threads}
|
|
threads={threads}
|
|
posts={posts}
|
|
posts={posts}
|
|
category={category}
|
|
category={category}
|
|
thread={thread}
|
|
thread={thread}
|
|
- post={post}
|
|
|
|
handles={handles}
|
|
handles={handles}
|
|
|
|
+ startTime={startTime}
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|