diff --git a/src/app/(page-detail)/[slug]/layout.tsx b/src/app/(page-detail)/[slug]/layout.tsx index 4b010ec3d3..ed17b87134 100644 --- a/src/app/(page-detail)/[slug]/layout.tsx +++ b/src/app/(page-detail)/[slug]/layout.tsx @@ -85,7 +85,11 @@ export default async (props: NextPageParams) => { - {isCN ? : } + {isCN ? ( + + ) : ( + + )} ) } diff --git a/src/app/notes/[id]/layout.tsx b/src/app/notes/[id]/layout.tsx index 41655abe7c..bdae6b898e 100644 --- a/src/app/notes/[id]/layout.tsx +++ b/src/app/notes/[id]/layout.tsx @@ -78,6 +78,8 @@ export default async ( const isCN = geo === 'CN' + const { id: noteObjectId, allowComment } = data.data + return ( <> @@ -86,7 +88,11 @@ export default async ( {props.children} - {isCN ? : } + {isCN ? ( + + ) : ( + + )} ) diff --git a/src/app/posts/(post-detail)/[category]/[slug]/layout.tsx b/src/app/posts/(post-detail)/[category]/[slug]/layout.tsx index e8231c9cc2..9e964d35bd 100644 --- a/src/app/posts/(post-detail)/[category]/[slug]/layout.tsx +++ b/src/app/posts/(post-detail)/[category]/[slug]/layout.tsx @@ -1,10 +1,14 @@ import React from 'react' +import { headers } from 'next/dist/client/components/headers' import { notFound } from 'next/navigation' import type { Metadata } from 'next' import { RequestError } from '@mx-space/api-client' +import { NotSupport } from '~/components/common/NotSupport' import { BottomToUpTransitionView } from '~/components/ui/transition/BottomToUpTransitionView' +import { CommentAreaRoot } from '~/components/widgets/comment' +import { REQUEST_GEO } from '~/constants/system' import { attachUA } from '~/lib/attach-ua' import { getSummaryFromMd } from '~/lib/markdown' import { CurrentPostDataProvider } from '~/providers/post/CurrentPostDataProvider' @@ -73,6 +77,10 @@ export default async (props: NextPageParams) => { } throw error }) + const header = headers() + const geo = header.get(REQUEST_GEO) + + const isCN = geo === 'CN' return ( <> @@ -80,6 +88,12 @@ export default async (props: NextPageParams) => {
{props.children} + + {isCN ? ( + + ) : ( + + )} diff --git a/src/app/posts/(post-detail)/[category]/[slug]/page.tsx b/src/app/posts/(post-detail)/[category]/[slug]/page.tsx index acd4ba0566..db426f1a00 100644 --- a/src/app/posts/(post-detail)/[category]/[slug]/page.tsx +++ b/src/app/posts/(post-detail)/[category]/[slug]/page.tsx @@ -8,7 +8,6 @@ import type { PropsWithChildren } from 'react' import { ClientOnly } from '~/components/common/ClientOnly' import { useSetHeaderMetaInfo } from '~/components/layout/header/hooks' import { Markdown } from '~/components/ui/markdown' -import { CommentAreaRoot } from '~/components/widgets/comment' import { PostActionAside } from '~/components/widgets/post/PostActionAside' import { PostCopyright } from '~/components/widgets/post/PostCopyright' import { PostMetaBar } from '~/components/widgets/post/PostMetaBar' @@ -29,6 +28,7 @@ import Loading from './loading' const PostPage = () => { const id = useCurrentPostDataSelector((p) => p?.id) const title = useCurrentPostDataSelector((p) => p?.title) + const allowComment = useCurrentPostDataSelector((p) => p?.allowComment) if (!id) { return } @@ -71,8 +71,6 @@ const PostPage = () => { - -
) } diff --git a/src/components/widgets/comment/CommentRoot.tsx b/src/components/widgets/comment/CommentRoot.tsx index 4574e1b797..064f5bb933 100644 --- a/src/components/widgets/comment/CommentRoot.tsx +++ b/src/components/widgets/comment/CommentRoot.tsx @@ -8,7 +8,17 @@ import { CommentBoxRoot } from './CommentBox/Root' import { Comments } from './Comments' const LoadingElement = -export const CommentAreaRoot: FC = (props) => { +export const CommentAreaRoot: FC< + CommentBaseProps & { + allowComment: boolean + } +> = (props) => { + if (!props.allowComment) { + return ( +

评论已关闭

+ ) + } + return (
diff --git a/tailwind.config.ts b/tailwind.config.ts index fd5b4a2006..ee26bbf341 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -244,8 +244,8 @@ const twConfig: Config = { { dark: { 'color-scheme': 'dark', - primary: '#1f8f93', - secondary: '#92bbff', + primary: '#91bef0', + secondary: '#39C5BB', accent: '#91bef0', neutral: UIKitColors.grey3.dark,