mirror of https://github.com/LemmyNet/lemmy.git
Adding a sorting help. Fixes #532
parent
585da4e911
commit
c3d4538219
|
@ -6,6 +6,18 @@ Start typing...
|
||||||
- `#a_community` to get a list of communities.
|
- `#a_community` to get a list of communities.
|
||||||
- `:emoji` to get a list of emojis.
|
- `:emoji` to get a list of emojis.
|
||||||
|
|
||||||
|
## Sorting
|
||||||
|
|
||||||
|
*Applies to both posts and comments*
|
||||||
|
|
||||||
|
Type | Description
|
||||||
|
--- | ---
|
||||||
|
Hot | Shows *trending* posts, based on the score, and the most recent comment time.
|
||||||
|
New | Newest posts.
|
||||||
|
Top | Shows the highest scoring posts in the given time frame.
|
||||||
|
|
||||||
|
For more detail, check the [Post and Comment Ranking details](about_ranking.md).
|
||||||
|
|
||||||
## Markdown Guide
|
## Markdown Guide
|
||||||
|
|
||||||
Type | Or | … to Get
|
Type | Or | … to Get
|
||||||
|
|
|
@ -18,7 +18,7 @@ Score = Upvotes - Downvotes
|
||||||
Time = time since submission (in hours)
|
Time = time since submission (in hours)
|
||||||
Gravity = Decay gravity, 1.8 is default
|
Gravity = Decay gravity, 1.8 is default
|
||||||
```
|
```
|
||||||
|
- For posts, in order to bring up active posts, it uses the latest comment time (limited to a max creation age of a month ago)
|
||||||
- Use Max(1, score) to make sure all comments are affected by time decay.
|
- Use Max(1, score) to make sure all comments are affected by time decay.
|
||||||
- Add 3 to the score, so that everything that has less than 3 downvotes will seem new. Otherwise all new comments would stay at zero, near the bottom.
|
- Add 3 to the score, so that everything that has less than 3 downvotes will seem new. Otherwise all new comments would stay at zero, near the bottom.
|
||||||
- The sign and abs of the score are necessary for dealing with the log of negative scores.
|
- The sign and abs of the score are necessary for dealing with the log of negative scores.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Component, linkEvent } from 'inferno';
|
import { Component, linkEvent } from 'inferno';
|
||||||
import { SortType } from '../interfaces';
|
import { SortType } from '../interfaces';
|
||||||
|
import { sortingHelpUrl } from '../utils';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
|
||||||
interface SortSelectProps {
|
interface SortSelectProps {
|
||||||
|
@ -24,23 +25,35 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<select
|
<>
|
||||||
value={this.state.sort}
|
<select
|
||||||
onChange={linkEvent(this, this.handleSortChange)}
|
value={this.state.sort}
|
||||||
class="custom-select custom-select-sm w-auto"
|
onChange={linkEvent(this, this.handleSortChange)}
|
||||||
>
|
class="custom-select custom-select-sm w-auto mr-2"
|
||||||
<option disabled>{i18n.t('sort_type')}</option>
|
>
|
||||||
{!this.props.hideHot && (
|
<option disabled>{i18n.t('sort_type')}</option>
|
||||||
<option value={SortType.Hot}>{i18n.t('hot')}</option>
|
{!this.props.hideHot && (
|
||||||
)}
|
<option value={SortType.Hot}>{i18n.t('hot')}</option>
|
||||||
<option value={SortType.New}>{i18n.t('new')}</option>
|
)}
|
||||||
<option disabled>─────</option>
|
<option value={SortType.New}>{i18n.t('new')}</option>
|
||||||
<option value={SortType.TopDay}>{i18n.t('top_day')}</option>
|
<option disabled>─────</option>
|
||||||
<option value={SortType.TopWeek}>{i18n.t('week')}</option>
|
<option value={SortType.TopDay}>{i18n.t('top_day')}</option>
|
||||||
<option value={SortType.TopMonth}>{i18n.t('month')}</option>
|
<option value={SortType.TopWeek}>{i18n.t('week')}</option>
|
||||||
<option value={SortType.TopYear}>{i18n.t('year')}</option>
|
<option value={SortType.TopMonth}>{i18n.t('month')}</option>
|
||||||
<option value={SortType.TopAll}>{i18n.t('all')}</option>
|
<option value={SortType.TopYear}>{i18n.t('year')}</option>
|
||||||
</select>
|
<option value={SortType.TopAll}>{i18n.t('all')}</option>
|
||||||
|
</select>
|
||||||
|
<a
|
||||||
|
className="text-muted"
|
||||||
|
href={sortingHelpUrl}
|
||||||
|
target="_blank"
|
||||||
|
title={i18n.t('sorting_help')}
|
||||||
|
>
|
||||||
|
<svg class={`icon icon-inline`}>
|
||||||
|
<use xlinkHref="#icon-help-circle"></use>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,9 @@ import Toastify from 'toastify-js';
|
||||||
import tippy from 'tippy.js';
|
import tippy from 'tippy.js';
|
||||||
|
|
||||||
export const repoUrl = 'https://github.com/dessalines/lemmy';
|
export const repoUrl = 'https://github.com/dessalines/lemmy';
|
||||||
export const markdownHelpUrl = '/docs/about_guide.html';
|
export const helpGuideUrl = '/docs/about_guide.html';
|
||||||
|
export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`;
|
||||||
|
export const sortingHelpUrl = `${helpGuideUrl}#sorting`;
|
||||||
export const archiveUrl = 'https://archive.is';
|
export const archiveUrl = 'https://archive.is';
|
||||||
|
|
||||||
export const postRefetchSeconds: number = 60 * 1000;
|
export const postRefetchSeconds: number = 60 * 1000;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
"upload_avatar": "Upload Avatar",
|
"upload_avatar": "Upload Avatar",
|
||||||
"show_avatars": "Show Avatars",
|
"show_avatars": "Show Avatars",
|
||||||
"formatting_help": "formatting help",
|
"formatting_help": "formatting help",
|
||||||
|
"sorting_help": "sorting help",
|
||||||
"view_source": "view source",
|
"view_source": "view source",
|
||||||
"unlock": "unlock",
|
"unlock": "unlock",
|
||||||
"lock": "lock",
|
"lock": "lock",
|
||||||
|
|
Loading…
Reference in New Issue