From 2f9a052f89fe8d34fedcd2219e644dd51cda5505 Mon Sep 17 00:00:00 2001
From: Richard <richard@tripaneer.com>
Date: Fri, 31 Jan 2020 21:52:27 +0100
Subject: usability features

This are all the commits from another PR combined into a single commit.
---
 ui/src/components/post.tsx | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

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

diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 36621248..1d84efac 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -155,11 +155,11 @@ export class Post extends Component<any, PostState> {
     return (
       <div class="container">
         {this.state.loading ? (
-          <h5>
+          <p class="text-center">
             <svg class="icon icon-spinner spin">
               <use xlinkHref="#icon-spinner"></use>
             </svg>
-          </h5>
+          </p>
         ) : (
           <div class="row">
             <div class="col-12 col-md-8 mb-3">
@@ -173,7 +173,7 @@ export class Post extends Component<any, PostState> {
               {this.state.crossPosts.length > 0 && (
                 <>
                   <div class="my-1 text-muted small font-weight-bold">
-                    <T i18nKey="cross_posts">#</T>
+                    { i18n.t('cross_posts') }
                   </div>
                   <PostListings showCommunity posts={this.state.crossPosts} />
                 </>
@@ -235,18 +235,6 @@ export class Post extends Component<any, PostState> {
             onChange={linkEvent(this, this.handleCommentSortChange)}
           />
         </label>
-        <label
-          className={`btn btn-sm btn-secondary pointer ${this.state
-            .commentSort === CommentSortType.Old && 'active'}`}
-        >
-          {i18n.t('old')}
-          <input
-            type="radio"
-            value={CommentSortType.Old}
-            checked={this.state.commentSort === CommentSortType.Old}
-            onChange={linkEvent(this, this.handleCommentSortChange)}
-          />
-        </label>
       </div>
     );
   }
@@ -256,7 +244,7 @@ export class Post extends Component<any, PostState> {
       <div class="d-none d-md-block new-comments mb-3 card border-secondary">
         <div class="card-body small">
           <h6>
-            <T i18nKey="recent_comments">#</T>
+            { i18n.t('recent_comments') }
           </h6>
           {this.state.comments.map(comment => (
             <CommentNodes
@@ -329,13 +317,6 @@ export class Post extends Component<any, PostState> {
           +a.comment.deleted - +b.comment.deleted ||
           b.comment.published.localeCompare(a.comment.published)
       );
-    } else if (this.state.commentSort == CommentSortType.Old) {
-      tree.sort(
-        (a, b) =>
-          +a.comment.removed - +b.comment.removed ||
-          +a.comment.deleted - +b.comment.deleted ||
-          a.comment.published.localeCompare(b.comment.published)
-      );
     } else if (this.state.commentSort == CommentSortType.Hot) {
       tree.sort(
         (a, b) =>
-- 
cgit v1.2.3


From ac943f8951fe7da86aaa9f41ee879ab670786c86 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 2 Feb 2020 13:50:44 -0500
Subject: Finishing up interpolation rework.

---
 ui/src/components/post.tsx | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

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

diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 1d84efac..9bde8585 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -11,7 +11,6 @@ import {
   CommentForm as CommentFormI,
   CommentResponse,
   CommentSortType,
-  CreatePostLikeResponse,
   CommunityUser,
   CommunityResponse,
   CommentNode as CommentNodeI,
@@ -38,7 +37,6 @@ import { CommentForm } from './comment-form';
 import { CommentNodes } from './comment-nodes';
 import autosize from 'autosize';
 import { i18n } from '../i18next';
-import { T } from 'inferno-i18next';
 
 interface PostState {
   post: PostI;
@@ -155,11 +153,11 @@ export class Post extends Component<any, PostState> {
     return (
       <div class="container">
         {this.state.loading ? (
-          <p class="text-center">
+          <h5>
             <svg class="icon icon-spinner spin">
               <use xlinkHref="#icon-spinner"></use>
             </svg>
-          </p>
+          </h5>
         ) : (
           <div class="row">
             <div class="col-12 col-md-8 mb-3">
@@ -173,7 +171,7 @@ export class Post extends Component<any, PostState> {
               {this.state.crossPosts.length > 0 && (
                 <>
                   <div class="my-1 text-muted small font-weight-bold">
-                    { i18n.t('cross_posts') }
+                    {i18n.t('cross_posts')}
                   </div>
                   <PostListings showCommunity posts={this.state.crossPosts} />
                 </>
@@ -243,9 +241,7 @@ export class Post extends Component<any, PostState> {
     return (
       <div class="d-none d-md-block new-comments mb-3 card border-secondary">
         <div class="card-body small">
-          <h6>
-            { i18n.t('recent_comments') }
-          </h6>
+          <h6>{i18n.t('recent_comments')}</h6>
           {this.state.comments.map(comment => (
             <CommentNodes
               nodes={[{ comment: comment }]}
@@ -412,7 +408,7 @@ export class Post extends Component<any, PostState> {
       }
       this.setState(this.state);
     } else if (res.op == UserOperation.CreatePostLike) {
-      let data = res.data as CreatePostLikeResponse;
+      let data = res.data as PostResponse;
       this.state.post.my_vote = data.post.my_vote;
       this.state.post.score = data.post.score;
       this.state.post.upvotes = data.post.upvotes;
-- 
cgit v1.2.3


From ccda4d8453f796d3929dbda21c0b2e19099d8b74 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 2 Feb 2020 14:10:15 -0500
Subject: Some minor fixes.

---
 ui/src/components/post.tsx | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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

diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 9bde8585..a8a94f0b 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -233,6 +233,18 @@ export class Post extends Component<any, PostState> {
             onChange={linkEvent(this, this.handleCommentSortChange)}
           />
         </label>
+        <label
+          className={`btn btn-sm btn-secondary pointer ${this.state
+            .commentSort === CommentSortType.Old && 'active'}`}
+        >
+          {i18n.t('old')}
+          <input
+            type="radio"
+            value={CommentSortType.Old}
+            checked={this.state.commentSort === CommentSortType.Old}
+            onChange={linkEvent(this, this.handleCommentSortChange)}
+          />
+        </label>
       </div>
     );
   }
@@ -313,6 +325,13 @@ export class Post extends Component<any, PostState> {
           +a.comment.deleted - +b.comment.deleted ||
           b.comment.published.localeCompare(a.comment.published)
       );
+    } else if (this.state.commentSort == CommentSortType.Old) {
+      tree.sort(
+        (a, b) =>
+          +a.comment.removed - +b.comment.removed ||
+          +a.comment.deleted - +b.comment.deleted ||
+          a.comment.published.localeCompare(b.comment.published)
+      );
     } else if (this.state.commentSort == CommentSortType.Hot) {
       tree.sort(
         (a, b) =>
-- 
cgit v1.2.3

