From c3d45382192357c599b0679fe6dee861c4dfd1f7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Mar 2020 14:18:40 -0500 Subject: [PATCH] Adding a sorting help. Fixes #532 --- docs/src/about_guide.md | 12 ++++++++ docs/src/about_ranking.md | 2 +- ui/src/components/sort-select.tsx | 47 ++++++++++++++++++++----------- ui/src/utils.ts | 4 ++- ui/translations/en.json | 1 + 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/docs/src/about_guide.md b/docs/src/about_guide.md index f22e201be..16788ab93 100644 --- a/docs/src/about_guide.md +++ b/docs/src/about_guide.md @@ -6,6 +6,18 @@ Start typing... - `#a_community` to get a list of communities. - `: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 Type | Or | … to Get diff --git a/docs/src/about_ranking.md b/docs/src/about_ranking.md index 361dc24d8..d318ae82d 100644 --- a/docs/src/about_ranking.md +++ b/docs/src/about_ranking.md @@ -18,7 +18,7 @@ Score = Upvotes - Downvotes Time = time since submission (in hours) 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. - 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. diff --git a/ui/src/components/sort-select.tsx b/ui/src/components/sort-select.tsx index 5515f746c..a6ce2ea98 100644 --- a/ui/src/components/sort-select.tsx +++ b/ui/src/components/sort-select.tsx @@ -1,5 +1,6 @@ import { Component, linkEvent } from 'inferno'; import { SortType } from '../interfaces'; +import { sortingHelpUrl } from '../utils'; import { i18n } from '../i18next'; interface SortSelectProps { @@ -24,23 +25,35 @@ export class SortSelect extends Component { render() { return ( - + <> + + + + + + + ); } diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 8e456cc56..ea09cf963 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -44,7 +44,9 @@ import Toastify from 'toastify-js'; import tippy from 'tippy.js'; 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 postRefetchSeconds: number = 60 * 1000; diff --git a/ui/translations/en.json b/ui/translations/en.json index b097b3f1b..ea063fcaf 100644 --- a/ui/translations/en.json +++ b/ui/translations/en.json @@ -40,6 +40,7 @@ "upload_avatar": "Upload Avatar", "show_avatars": "Show Avatars", "formatting_help": "formatting help", + "sorting_help": "sorting help", "view_source": "view source", "unlock": "unlock", "lock": "lock",