File tree 6 files changed +40
-8
lines changed
posts/(post-detail)/[category]/[slug]
6 files changed +40
-8
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,11 @@ export default async (props: NextPageParams<PageParams>) => {
85
85
86
86
< LayoutRightSideProvider className = "absolute bottom-0 right-0 top-0 hidden translate-x-full lg:block" />
87
87
</ div >
88
- { isCN ? < NotSupport /> : < CommentAreaRoot refId = { data . id } /> }
88
+ { isCN ? (
89
+ < NotSupport />
90
+ ) : (
91
+ < CommentAreaRoot refId = { data . id } allowComment = { data . allowComment } />
92
+ ) }
89
93
</ >
90
94
)
91
95
}
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ export default async (
78
78
79
79
const isCN = geo === 'CN'
80
80
81
+ const { id : noteObjectId , allowComment } = data . data
82
+
81
83
return (
82
84
< >
83
85
< CurrentNoteIdProvider noteId = { id } />
@@ -86,7 +88,11 @@ export default async (
86
88
87
89
< BottomToUpTransitionView className = "min-w-0" >
88
90
< Paper as = { NoteMainContainer } > { props . children } </ Paper >
89
- { isCN ? < NotSupport /> : < CommentAreaRoot refId = { data . data . id } /> }
91
+ { isCN ? (
92
+ < NotSupport />
93
+ ) : (
94
+ < CommentAreaRoot refId = { noteObjectId } allowComment = { allowComment } />
95
+ ) }
90
96
</ BottomToUpTransitionView >
91
97
</ >
92
98
)
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
+ import { headers } from 'next/dist/client/components/headers'
2
3
import { notFound } from 'next/navigation'
3
4
import type { Metadata } from 'next'
4
5
5
6
import { RequestError } from '@mx-space/api-client'
6
7
8
+ import { NotSupport } from '~/components/common/NotSupport'
7
9
import { BottomToUpTransitionView } from '~/components/ui/transition/BottomToUpTransitionView'
10
+ import { CommentAreaRoot } from '~/components/widgets/comment'
11
+ import { REQUEST_GEO } from '~/constants/system'
8
12
import { attachUA } from '~/lib/attach-ua'
9
13
import { getSummaryFromMd } from '~/lib/markdown'
10
14
import { CurrentPostDataProvider } from '~/providers/post/CurrentPostDataProvider'
@@ -73,13 +77,23 @@ export default async (props: NextPageParams<PageParams>) => {
73
77
}
74
78
throw error
75
79
} )
80
+ const header = headers ( )
81
+ const geo = header . get ( REQUEST_GEO )
82
+
83
+ const isCN = geo === 'CN'
76
84
77
85
return (
78
86
< >
79
87
< CurrentPostDataProvider data = { data } />
80
88
< div className = "relative flex min-h-[120px] grid-cols-[auto,200px] lg:grid" >
81
89
< BottomToUpTransitionView className = "min-w-0" >
82
90
{ props . children }
91
+
92
+ { isCN ? (
93
+ < NotSupport />
94
+ ) : (
95
+ < CommentAreaRoot refId = { data . id } allowComment = { data . allowComment } />
96
+ ) }
83
97
</ BottomToUpTransitionView >
84
98
85
99
< LayoutRightSideProvider className = "relative hidden lg:block" />
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import type { PropsWithChildren } from 'react'
8
8
import { ClientOnly } from '~/components/common/ClientOnly'
9
9
import { useSetHeaderMetaInfo } from '~/components/layout/header/hooks'
10
10
import { Markdown } from '~/components/ui/markdown'
11
- import { CommentAreaRoot } from '~/components/widgets/comment'
12
11
import { PostActionAside } from '~/components/widgets/post/PostActionAside'
13
12
import { PostCopyright } from '~/components/widgets/post/PostCopyright'
14
13
import { PostMetaBar } from '~/components/widgets/post/PostMetaBar'
@@ -29,6 +28,7 @@ import Loading from './loading'
29
28
const PostPage = ( ) => {
30
29
const id = useCurrentPostDataSelector ( ( p ) => p ?. id )
31
30
const title = useCurrentPostDataSelector ( ( p ) => p ?. title )
31
+ const allowComment = useCurrentPostDataSelector ( ( p ) => p ?. allowComment )
32
32
if ( ! id ) {
33
33
return < Loading />
34
34
}
@@ -71,8 +71,6 @@ const PostPage = () => {
71
71
< SubscribeBell defaultType = "post_c" />
72
72
< XLogInfoForPost />
73
73
</ ClientOnly >
74
-
75
- < CommentAreaRoot refId = { id } />
76
74
</ div >
77
75
)
78
76
}
Original file line number Diff line number Diff line change @@ -8,7 +8,17 @@ import { CommentBoxRoot } from './CommentBox/Root'
8
8
import { Comments } from './Comments'
9
9
10
10
const LoadingElement = < Loading loadingText = "评论区加载中..." />
11
- export const CommentAreaRoot : FC < CommentBaseProps > = ( props ) => {
11
+ export const CommentAreaRoot : FC <
12
+ CommentBaseProps & {
13
+ allowComment : boolean
14
+ }
15
+ > = ( props ) => {
16
+ if ( ! props . allowComment ) {
17
+ return (
18
+ < p className = "mt-[100px] text-center text-xl font-medium" > 评论已关闭</ p >
19
+ )
20
+ }
21
+
12
22
return (
13
23
< LazyLoad placeholder = { LoadingElement } >
14
24
< div className = "relative mt-12" >
Original file line number Diff line number Diff line change @@ -244,8 +244,8 @@ const twConfig: Config = {
244
244
{
245
245
dark : {
246
246
'color-scheme' : 'dark' ,
247
- primary : '#1f8f93 ' ,
248
- secondary : '#92bbff ' ,
247
+ primary : '#91bef0 ' ,
248
+ secondary : '#39C5BB ' ,
249
249
accent : '#91bef0' ,
250
250
251
251
neutral : UIKitColors . grey3 . dark ,
You can’t perform that action at this time.
0 commit comments