X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fcommunity%2Fcommunity.tsx;h=b88d6f6100e03843ef387ad60a3c8d524a0b1650;hb=53c3cfeade90150b07431386745a24aa699a25ec;hp=b833ca9a3cfb7a5ca5dadcf7381424b31a6b2a07;hpb=5960b85e46cfd08f5c454d0e6fc6bd1f24cf0821;p=lemmy-ui.git diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index b833ca9..b88d6f6 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -1,4 +1,28 @@ -import { Component, linkEvent } from "inferno"; +import { + commentsToFlatNodes, + communityRSSUrl, + editComment, + editPost, + editWith, + enableDownvotes, + enableNsfw, + getCommentParentId, + getDataTypeString, + myAuth, + postToCommentSortType, + setIsoData, + showLocal, + updateCommunityBlock, + updatePersonBlock, +} from "@utils/app"; +import { + getPageFromString, + getQueryParams, + getQueryString, +} from "@utils/helpers"; +import type { QueryParams } from "@utils/types"; +import { RouteDataResponse } from "@utils/types"; +import { Component, RefObject, createRef, linkEvent } from "inferno"; import { RouteComponentProps } from "inferno-router/dist/Route"; import { AddAdmin, @@ -52,43 +76,16 @@ import { SortType, TransferCommunity, } from "lemmy-js-client"; -import { i18n } from "../../i18next"; +import { fetchLimit, relTags } from "../../config"; import { CommentViewType, DataType, 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 { - QueryParams, - RouteDataResponse, - commentsToFlatNodes, - communityRSSUrl, - editComment, - editPost, - editWith, - enableDownvotes, - enableNsfw, - fetchLimit, - getCommentParentId, - getDataTypeString, - getPageFromString, - getQueryParams, - getQueryString, - myAuth, - postToCommentSortType, - relTags, - restoreScrollPosition, - saveScrollPosition, - setIsoData, - setupTippy, - showLocal, - toast, - updateCommunityBlock, - updatePersonBlock, -} from "../../utils"; +import { setupTippy } from "../../tippy"; +import { toast } from "../../toast"; import { CommentNodes } from "../comment/comment-nodes"; import { BannerIconHeader } from "../common/banner-icon-header"; import { DataTypeSelect } from "../common/data-type-select"; @@ -157,7 +154,7 @@ export class Community extends Component< finished: new Map(), isIsomorphic: false, }; - + private readonly mainContentRef: RefObject; constructor(props: RouteComponentProps<{ name: string }>, context: any) { super(props, context); @@ -198,7 +195,7 @@ export class Community extends Component< this.handleSavePost = this.handleSavePost.bind(this); this.handlePurgePost = this.handlePurgePost.bind(this); this.handleFeaturePost = this.handleFeaturePost.bind(this); - + this.mainContentRef = createRef(); // Only fetch the data if coming from another route if (FirstLoadService.isFirstLoad) { const { communityRes, commentsRes, postsRes } = this.isoData.routeData; @@ -231,10 +228,6 @@ export class Community extends Component< setupTippy(); } - componentWillUnmount() { - saveScrollPosition(this.context); - } - static async fetchInitialData({ client, path, @@ -319,19 +312,23 @@ export class Community extends Component<
-
+
{this.communityInfo(res)}
-
+
+
+
); @@ -489,7 +486,7 @@ export class Community extends Component< community && (
-
{community.title}
+

{community.title}

) { if (purgeRes.state == "success") { - toast(i18n.t("purge_success")); + toast(I18NextService.i18n.t("purge_success")); this.context.router.history.push(`/`); } }