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

