Add most commented (#159)

* Adding MostComments sort.

* Updating translations.
This commit is contained in:
Dessalines 2021-02-01 13:48:42 -05:00 committed by GitHub
parent aab038580e
commit 27fd4a4626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View file

@ -292,6 +292,7 @@ export class Inbox extends Component<any, InboxState> {
sort={this.state.sort}
onChange={this.handleSortChange}
hideHot
hideMostComments
/>
</div>
);

View file

@ -245,6 +245,7 @@ export class Search extends Component<any, SearchState> {
sort={this.state.sort}
onChange={this.handleSortChange}
hideHot
hideMostComments
/>
</span>
</div>

View 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>

View 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}`}