From: Ivo Barros <devL3v3L@gmail.com>
Date: Sat, 17 Jun 2023 08:37:03 +0000 (+0100)
Subject: add hours as sorting options
X-Git-Url: http://these/git/%22%7Bauthor_url%7D/static/%24%7BappleTouchIcon%7D?a=commitdiff_plain;h=3ca24607fbf5c08f83243fc259dcd159bb0a24f2;p=lemmy-ui.git

add hours as sorting options
---

diff --git a/src/shared/components/common/sort-select.tsx b/src/shared/components/common/sort-select.tsx
index dac6e20..1fd3207 100644
--- a/src/shared/components/common/sort-select.tsx
+++ b/src/shared/components/common/sort-select.tsx
@@ -66,6 +66,9 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
           <option disabled aria-hidden="true">
             ─────
           </option>
+          <option value={"TopHour"}>{i18n.t("top_hour")}</option>
+          <option value={"TopSixHour"}>{i18n.t("top_six_hours")}</option>
+          <option value={"TopTwelveHour"}>{i18n.t("top_twelve_hours")}</option>
           <option value={"TopDay"}>{i18n.t("top_day")}</option>
           <option value={"TopWeek"}>{i18n.t("top_week")}</option>
           <option value={"TopMonth"}>{i18n.t("top_month")}</option>
diff --git a/src/shared/utils.ts b/src/shared/utils.ts
index c7fbca6..abb3062 100644
--- a/src/shared/utils.ts
+++ b/src/shared/utils.ts
@@ -986,6 +986,9 @@ export function commentsToFlatNodes(comments: CommentView[]): CommentNodeI[] {
 export function convertCommentSortType(sort: SortType): CommentSortType {
   if (
     sort == "TopAll" ||
+    sort ==  "TopHour" ||
+    sort ==  "TopSixHour" ||
+    sort ==  "TopTwelveHour" ||
     sort == "TopDay" ||
     sort == "TopWeek" ||
     sort == "TopMonth" ||