]> Untitled Git - lemmy-ui.git/commitdiff
Add most commented (#159)
authorDessalines <dessalines@users.noreply.github.com>
Mon, 1 Feb 2021 18:48:42 +0000 (13:48 -0500)
committerGitHub <noreply@github.com>
Mon, 1 Feb 2021 18:48:42 +0000 (13:48 -0500)
* Adding MostComments sort.

* Updating translations.

src/shared/components/inbox.tsx
src/shared/components/search.tsx
src/shared/components/sort-select.tsx
src/shared/components/user.tsx

index 6c6f5d903d39235f042024f4e467326b22fba45a..1dae9fd0db148d467e319e42a93da916046729f6 100644 (file)
@@ -292,6 +292,7 @@ export class Inbox extends Component<any, InboxState> {
           sort={this.state.sort}
           onChange={this.handleSortChange}
           hideHot
+          hideMostComments
         />
       </div>
     );
index 65b1a78edb0ba2b0faf467edf26fca9c1ea7e608..1cdd35f1ac877919a36bc82daff40f5fff233574 100644 (file)
@@ -245,6 +245,7 @@ export class Search extends Component<any, SearchState> {
             sort={this.state.sort}
             onChange={this.handleSortChange}
             hideHot
+            hideMostComments
           />
         </span>
       </div>
index f711703d16ab826ae9b44a0f88c9b05e0ec510ca..ef14a6e8ed402ff3f7a83069a77b13e4a9d86409 100644 (file)
@@ -7,6 +7,7 @@ interface SortSelectProps {
   sort: SortType;
   onChange?(val: SortType): any;
   hideHot?: boolean;
+  hideMostComments?: boolean;
 }
 
 interface SortSelectState {
@@ -41,13 +42,16 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
           class="custom-select w-auto mr-2 mb-2"
         >
           <option disabled>{i18n.t('sort_type')}</option>
-          {!this.props.hideHot && (
-            <option value={SortType.Hot}>{i18n.t('hot')}</option>
-          )}
-          {!this.props.hideHot && (
-            <option value={SortType.Active}>{i18n.t('active')}</option>
-          )}
+          {!this.props.hideHot && [
+            <option value={SortType.Hot}>{i18n.t('hot')}</option>,
+            <option value={SortType.Active}>{i18n.t('active')}</option>,
+          ]}
           <option value={SortType.New}>{i18n.t('new')}</option>
+          {!this.props.hideMostComments && (
+            <option value={SortType.MostComments}>
+              {i18n.t('most_comments')}
+            </option>
+          )}
           <option disabled>─────</option>
           <option value={SortType.TopDay}>{i18n.t('top_day')}</option>
           <option value={SortType.TopWeek}>{i18n.t('top_week')}</option>
index 43f872cea8719fc68f55699eab25fb6bea6f6e1a..e5cd9feb2aa14d0fb2873ac92f09cb3951814775 100644 (file)
@@ -382,6 +382,7 @@ export class User extends Component<any, UserState> {
           sort={this.state.sort}
           onChange={this.handleSortChange}
           hideHot
+          hideMostComments
         />
         <a
           href={`/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`}