mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 15:51:14 +00:00
Add most commented (#159)
* Adding MostComments sort. * Updating translations.
This commit is contained in:
parent
aab038580e
commit
27fd4a4626
4 changed files with 13 additions and 6 deletions
|
@ -292,6 +292,7 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
sort={this.state.sort}
|
sort={this.state.sort}
|
||||||
onChange={this.handleSortChange}
|
onChange={this.handleSortChange}
|
||||||
hideHot
|
hideHot
|
||||||
|
hideMostComments
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -245,6 +245,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
sort={this.state.sort}
|
sort={this.state.sort}
|
||||||
onChange={this.handleSortChange}
|
onChange={this.handleSortChange}
|
||||||
hideHot
|
hideHot
|
||||||
|
hideMostComments
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,7 @@ interface SortSelectProps {
|
||||||
sort: SortType;
|
sort: SortType;
|
||||||
onChange?(val: SortType): any;
|
onChange?(val: SortType): any;
|
||||||
hideHot?: boolean;
|
hideHot?: boolean;
|
||||||
|
hideMostComments?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SortSelectState {
|
interface SortSelectState {
|
||||||
|
@ -41,13 +42,16 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
|
||||||
class="custom-select w-auto mr-2 mb-2"
|
class="custom-select w-auto mr-2 mb-2"
|
||||||
>
|
>
|
||||||
<option disabled>{i18n.t('sort_type')}</option>
|
<option disabled>{i18n.t('sort_type')}</option>
|
||||||
{!this.props.hideHot && (
|
{!this.props.hideHot && [
|
||||||
<option value={SortType.Hot}>{i18n.t('hot')}</option>
|
<option value={SortType.Hot}>{i18n.t('hot')}</option>,
|
||||||
)}
|
<option value={SortType.Active}>{i18n.t('active')}</option>,
|
||||||
{!this.props.hideHot && (
|
]}
|
||||||
<option value={SortType.Active}>{i18n.t('active')}</option>
|
|
||||||
)}
|
|
||||||
<option value={SortType.New}>{i18n.t('new')}</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 disabled>─────</option>
|
||||||
<option value={SortType.TopDay}>{i18n.t('top_day')}</option>
|
<option value={SortType.TopDay}>{i18n.t('top_day')}</option>
|
||||||
<option value={SortType.TopWeek}>{i18n.t('top_week')}</option>
|
<option value={SortType.TopWeek}>{i18n.t('top_week')}</option>
|
||||||
|
|
|
@ -382,6 +382,7 @@ export class User extends Component<any, UserState> {
|
||||||
sort={this.state.sort}
|
sort={this.state.sort}
|
||||||
onChange={this.handleSortChange}
|
onChange={this.handleSortChange}
|
||||||
hideHot
|
hideHot
|
||||||
|
hideMostComments
|
||||||
/>
|
/>
|
||||||
<a
|
<a
|
||||||
href={`/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`}
|
href={`/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`}
|
||||||
|
|
Loading…
Reference in a new issue