X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fpost%2Fpost.tsx;h=eeb713a9cef6538bc483776b3cbb0dbf7313b6b5;hb=53c3cfeade90150b07431386745a24aa699a25ec;hp=31fc2e7023c472b50853e35b755c24f2c12b15ad;hpb=51091185252f8796ed8adb6b77a032d8d1cc6961;p=lemmy-ui.git diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index 31fc2e7..eeb713a 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -19,10 +19,11 @@ import { restoreScrollPosition, saveScrollPosition, } from "@utils/browser"; -import { debounce } from "@utils/helpers"; +import { debounce, randomStr } from "@utils/helpers"; import { isImage } from "@utils/media"; import { RouteDataResponse } from "@utils/types"; import autosize from "autosize"; +import classNames from "classnames"; import { Component, RefObject, createRef, linkEvent } from "inferno"; import { AddAdmin, @@ -76,14 +77,12 @@ import { TransferCommunity, } from "lemmy-js-client"; import { commentTreeMaxDepth } from "../../config"; -import { i18n } from "../../i18next"; import { CommentNodeI, CommentViewType, InitialFetchRequest, } from "../../interfaces"; -import { UserService } from "../../services"; -import { FirstLoadService } from "../../services/FirstLoadService"; +import { FirstLoadService, I18NextService, UserService } from "../../services"; import { HttpService, RequestState } from "../../services/HttpService"; import { setupTippy } from "../../tippy"; import { toast } from "../../toast"; @@ -350,10 +349,11 @@ export class Post extends Component { const res = this.state.postRes.data; return (
-
+
@@ -400,7 +400,7 @@ export class Post extends Component { className="btn btn-secondary d-inline-block mb-2 me-3" onClick={linkEvent(this, this.handleShowSidebarMobile)} > - {i18n.t("sidebar")}{" "} + {I18NextService.i18n.t("sidebar")}{" "} { this.commentsTree()} {this.state.commentViewType == CommentViewType.Flat && this.commentsFlat()} -
-
{this.sidebar()}
+ +
); } @@ -430,80 +432,98 @@ export class Post extends Component { } sortRadios() { + const radioId = + this.state.postRes.state === "success" + ? this.state.postRes.data.post_view.post.id + : randomStr(); + return ( <> -
+
+ + + +
-
+
+
@@ -595,14 +615,14 @@ export class Post extends Component { className="ps-0 d-block btn btn-link text-muted" onClick={linkEvent(this, this.handleViewPost)} > - {i18n.t("view_all_comments")} ➔ + {I18NextService.i18n.t("view_all_comments")} ➔ {showContextButton && ( )} @@ -836,14 +856,14 @@ export class Post extends Component { async handleCommentReport(form: CreateCommentReport) { const reportRes = await HttpService.client.createCommentReport(form); if (reportRes.state == "success") { - toast(i18n.t("report_created")); + toast(I18NextService.i18n.t("report_created")); } } async handlePostReport(form: CreatePostReport) { const reportRes = await HttpService.client.createPostReport(form); if (reportRes.state == "success") { - toast(i18n.t("report_created")); + toast(I18NextService.i18n.t("report_created")); } } @@ -982,7 +1002,7 @@ export class Post extends Component { purgeItem(purgeRes: RequestState) { if (purgeRes.state == "success") { - toast(i18n.t("purge_success")); + toast(I18NextService.i18n.t("purge_success")); this.context.router.history.push(`/`); } }