From 49bf16e7d451388d894f93a994f3bf18571f9594 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 7 Apr 2019 22:19:02 -0700
Subject: Adding user details / overview page.

- Fixes #19
---
 ui/src/components/post-listings.tsx | 36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

(limited to 'ui/src/components/post-listings.tsx')

diff --git a/ui/src/components/post-listings.tsx b/ui/src/components/post-listings.tsx
index 98fe8f21..bb36cabc 100644
--- a/ui/src/components/post-listings.tsx
+++ b/ui/src/components/post-listings.tsx
@@ -2,12 +2,10 @@ import { Component, linkEvent } from 'inferno';
 import { Link } from 'inferno-router';
 import { Subscription } from "rxjs";
 import { retryWhen, delay, take } from 'rxjs/operators';
-import { UserOperation, Community as CommunityI, GetCommunityResponse, CommunityResponse, Post, GetPostsForm, ListingSortType, ListingType, GetPostsResponse, CreatePostLikeForm, CreatePostLikeResponse, CommunityUser} from '../interfaces';
+import { UserOperation, Community as CommunityI, Post, GetPostsForm, SortType, ListingType, GetPostsResponse, CreatePostLikeResponse, CommunityUser} from '../interfaces';
 import { WebSocketService, UserService } from '../services';
-import { MomentTime } from './moment-time';
 import { PostListing } from './post-listing';
-import { Sidebar } from './sidebar';
-import { msgOp, mdToHtml } from '../utils';
+import { msgOp } from '../utils';
 
 
 interface PostListingsProps {
@@ -18,7 +16,7 @@ interface PostListingsState {
   community: CommunityI;
   moderators: Array<CommunityUser>;
   posts: Array<Post>;
-  sortType: ListingSortType;
+  sortType: SortType;
   type_: ListingType;
 }
 
@@ -41,7 +39,7 @@ export class PostListings extends Component<PostListingsProps, PostListingsState
     },
     moderators: [],
     posts: [],
-    sortType: ListingSortType.Hot,
+    sortType: SortType.Hot,
     type_: this.props.communityId 
     ? ListingType.Community 
     : UserService.Instance.loggedIn
@@ -49,7 +47,7 @@ export class PostListings extends Component<PostListingsProps, PostListingsState
     : ListingType.All
   }
 
-  constructor(props, context) {
+  constructor(props: any, context: any) {
     super(props, context);
 
 
@@ -67,7 +65,7 @@ export class PostListings extends Component<PostListingsProps, PostListingsState
       type_: ListingType[this.state.type_],
       community_id: this.props.communityId,
       limit: 10,
-      sort: ListingSortType[ListingSortType.Hot],
+      sort: SortType[SortType.Hot],
     }
     WebSocketService.Instance.getPosts(getPostsForm);
   }
@@ -94,14 +92,14 @@ export class PostListings extends Component<PostListingsProps, PostListingsState
       <div className="mb-2">
         <select value={this.state.sortType} onChange={linkEvent(this, this.handleSortChange)} class="custom-select w-auto">
           <option disabled>Sort Type</option>
-          <option value={ListingSortType.Hot}>Hot</option>
-          <option value={ListingSortType.New}>New</option>
+          <option value={SortType.Hot}>Hot</option>
+          <option value={SortType.New}>New</option>
           <option disabled>──────────</option>
-          <option value={ListingSortType.TopDay}>Top Day</option>
-          <option value={ListingSortType.TopWeek}>Week</option>
-          <option value={ListingSortType.TopMonth}>Month</option>
-          <option value={ListingSortType.TopYear}>Year</option>
-          <option value={ListingSortType.TopAll}>All</option>
+          <option value={SortType.TopDay}>Top Day</option>
+          <option value={SortType.TopWeek}>Week</option>
+          <option value={SortType.TopMonth}>Month</option>
+          <option value={SortType.TopYear}>Year</option>
+          <option value={SortType.TopAll}>All</option>
         </select>
         {!this.props.communityId && 
           UserService.Instance.loggedIn &&
@@ -117,26 +115,26 @@ export class PostListings extends Component<PostListingsProps, PostListingsState
 
   }
 
-  handleSortChange(i: PostListings, event) {
+  handleSortChange(i: PostListings, event: any) {
     i.state.sortType = Number(event.target.value);
     i.setState(i.state);
 
     let getPostsForm: GetPostsForm = {
       community_id: i.state.community.id,
       limit: 10,
-      sort: ListingSortType[i.state.sortType],
+      sort: SortType[i.state.sortType],
       type_: ListingType[ListingType.Community]
     }
     WebSocketService.Instance.getPosts(getPostsForm);
   }
 
-  handleTypeChange(i: PostListings, event) {
+  handleTypeChange(i: PostListings, event: any) {
     i.state.type_ = Number(event.target.value);
     i.setState(i.state);
 
     let getPostsForm: GetPostsForm = {
       limit: 10,
-      sort: ListingSortType[i.state.sortType],
+      sort: SortType[i.state.sortType],
       type_: ListingType[i.state.type_]
     }
     WebSocketService.Instance.getPosts(getPostsForm);
-- 
cgit v1.2.3

