From: Pavlos Smith <57727226+iByteABit256@users.noreply.github.com> Date: Fri, 4 Aug 2023 20:32:07 +0000 (+0300) Subject: Lemmy 2515 controversial posts and comments (#1727) X-Git-Url: http://these/git/%7B%24%7B%60data:application/static/%24%7Bsrc%7D?a=commitdiff_plain;h=d923cfa522c19ff7b533e64d4e00438196000246;p=lemmy-ui.git Lemmy 2515 controversial posts and comments (#1727) * Added buttons to be able to sort posts and comments by controversy rank * Added buttons to be able to sort posts and comments by controversy rank * lost changes * Hiding controversial sort if downvotes disabled (unfinished) * Finished hiding sort option correctly * Removed newline * Removed hiding logic for now, this should be included in a future PR * woodpecker re-run * woodpecker re-run * woodpecker re-run * Update lemmy js-client version --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: SleeplessOne1917 <abias1122@gmail.com> --- diff --git a/package.json b/package.json index 27b9cb4..8e3694b 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "inferno-router": "^8.2.2", "inferno-server": "^8.2.2", "jwt-decode": "^3.1.2", - "lemmy-js-client": "0.18.1", + "lemmy-js-client": "0.19.0-rc.1", "lodash.isequal": "^4.5.0", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", diff --git a/src/shared/components/common/comment-sort-select.tsx b/src/shared/components/common/comment-sort-select.tsx index ad4eebf..f911558 100644 --- a/src/shared/components/common/comment-sort-select.tsx +++ b/src/shared/components/common/comment-sort-select.tsx @@ -48,6 +48,9 @@ export class CommentSortSelect extends Component< {I18NextService.i18n.t("sort_type")} </option> <option value={"Hot"}>{I18NextService.i18n.t("hot")}</option>, + <option value={"Controversial"}> + {I18NextService.i18n.t("controversial")} + </option> <option value={"Top"}>{I18NextService.i18n.t("top")}</option>, <option value={"New"}>{I18NextService.i18n.t("new")}</option> <option value={"Old"}>{I18NextService.i18n.t("old")}</option> diff --git a/src/shared/components/common/sort-select.tsx b/src/shared/components/common/sort-select.tsx index 088f45e..fe9ba4d 100644 --- a/src/shared/components/common/sort-select.tsx +++ b/src/shared/components/common/sort-select.tsx @@ -54,6 +54,9 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> { {I18NextService.i18n.t("active")} </option>, ]} + <option value={"Controversial"}> + {I18NextService.i18n.t("controversial")} + </option> <option value={"New"}>{I18NextService.i18n.t("new")}</option> <option value={"Old"}>{I18NextService.i18n.t("old")}</option> {!this.props.hideMostComments && [ diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index 0401228..49e7348 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -478,6 +478,22 @@ export class Post extends Component<any, PostState> { > {I18NextService.i18n.t("top")} </label> + <input + id={`${radioId}-controversial`} + type="radio" + className="btn-check" + value={"Controversial"} + checked={this.state.commentSort === "Controversial"} + onChange={linkEvent(this, this.handleCommentSortChange)} + /> + <label + htmlFor={`${radioId}-controversial`} + className={classNames("btn btn-outline-secondary pointer", { + active: this.state.commentSort === "Controversial", + })} + > + {I18NextService.i18n.t("controversial")} + </label> <input id={`${radioId}-new`} type="radio"