diff --git a/src/components/common/Comment.tsx b/src/components/common/Comment.tsx index bcf525be..94601a48 100644 --- a/src/components/common/Comment.tsx +++ b/src/components/common/Comment.tsx @@ -9,7 +9,7 @@ import { ExpandedNote } from "~/lib/types" import { cn } from "~/lib/utils" import { useGetComments } from "~/queries/page" -export const Comment = ({ +const Comment = ({ page, className, }: { @@ -90,3 +90,5 @@ const Loader = () => { ) } + +export default Comment diff --git a/src/components/site/PostFooter.tsx b/src/components/site/PostFooter.tsx index c8658d88..07cbc522 100644 --- a/src/components/site/PostFooter.tsx +++ b/src/components/site/PostFooter.tsx @@ -1,13 +1,14 @@ "use client" import { useInViewport } from "ahooks" +import dynamic from "next/dynamic" import { useEffect, useRef } from "react" import { useQuery, useQueryClient } from "@tanstack/react-query" -import { Comment } from "~/components/common/Comment" import { ReactionLike } from "~/components/common/ReactionLike" import { ReactionTip } from "~/components/common/ReactionTip" +import { useTranslation } from "~/lib/i18n/client" import { ExpandedCharacter, ExpandedNote } from "~/lib/types" const key = ["PostFooterInView"] @@ -34,6 +35,12 @@ export const PostFooter = ({ queryClient.setQueryData(key, () => isInView) }, [isInView]) + const { t } = useTranslation("common") + + const DynamicComment = dynamic(() => import("~/components/common/Comment"), { + loading: () =>

{t("Loading comments")}...

, + }) + return ( <>
- + ) } diff --git a/src/lib/i18n/locales/zh/common.json b/src/lib/i18n/locales/zh/common.json index a6918022..0200b98e 100644 --- a/src/lib/i18n/locales/zh/common.json +++ b/src/lib/i18n/locales/zh/common.json @@ -88,5 +88,6 @@ "Comment Without Login": "免登录评论", "Name": "昵称", "Email": "电子邮箱", - "You'll use an official public account for comments and give up blockchain ownership": "你将使用官方公共账号进行评论并放弃区块链所有权" + "You'll use an official public account for comments and give up blockchain ownership": "你将使用官方公共账号进行评论并放弃区块链所有权", + "Loading comments": "加载评论中" }