From 08d7695ef5d3081a6b8c450feb9528407682f46b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 28 Jul 2019 18:57:09 -0700 Subject: [PATCH] Adding similar post searching before creating post. - Fixes #185. - Offsetting create post and community columns. --- ui/src/components/create-community.tsx | 2 +- ui/src/components/create-post.tsx | 2 +- ui/src/components/post-form.tsx | 33 ++++++++++++++++++++++++-- ui/src/components/search.tsx | 1 - 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ui/src/components/create-community.tsx b/ui/src/components/create-community.tsx index 5e31efc2b..c2f89eef3 100644 --- a/ui/src/components/create-community.tsx +++ b/ui/src/components/create-community.tsx @@ -18,7 +18,7 @@ export class CreateCommunity extends Component { return (
-
+
Create Community
diff --git a/ui/src/components/create-post.tsx b/ui/src/components/create-post.tsx index 0e37ba1d9..e09bcf703 100644 --- a/ui/src/components/create-post.tsx +++ b/ui/src/components/create-post.tsx @@ -17,7 +17,7 @@ export class CreatePost extends Component { return (
-
+
Create a Post
diff --git a/ui/src/components/post-form.tsx b/ui/src/components/post-form.tsx index 50b4acd1c..9b33c6e14 100644 --- a/ui/src/components/post-form.tsx +++ b/ui/src/components/post-form.tsx @@ -1,7 +1,8 @@ import { Component, linkEvent } from 'inferno'; +import { PostListings } from './post-listings'; import { Subscription } from "rxjs"; import { retryWhen, delay, take } from 'rxjs/operators'; -import { PostForm as PostFormI, Post, PostResponse, UserOperation, Community, ListCommunitiesResponse, ListCommunitiesForm, SortType } from '../interfaces'; +import { PostForm as PostFormI, Post, PostResponse, UserOperation, Community, ListCommunitiesResponse, ListCommunitiesForm, SortType, SearchForm, SearchType, SearchResponse } from '../interfaces'; import { WebSocketService, UserService } from '../services'; import { msgOp, getPageTitle } from '../utils'; import * as autosize from 'autosize'; @@ -19,6 +20,7 @@ interface PostFormState { communities: Array; loading: boolean; suggestedTitle: string; + suggestedPosts: Array; } export class PostForm extends Component { @@ -34,6 +36,7 @@ export class PostForm extends Component { communities: [], loading: false, suggestedTitle: undefined, + suggestedPosts: [], } constructor(props: any, context: any) { @@ -86,7 +89,7 @@ export class PostForm extends Component {
{this.state.suggestedTitle && - copy suggested title: {this.state.suggestedTitle} +
copy suggested title: {this.state.suggestedTitle}
}
@@ -94,6 +97,12 @@ export class PostForm extends Component {