@@ -5,10 +5,12 @@ import { Balancer } from 'react-wrap-balancer'
5
5
import type { Image } from '@mx-space/api-client'
6
6
import type { PropsWithChildren } from 'react'
7
7
8
+ import { ClientOnly } from '~/components/common/ClientOnly'
8
9
import { ReadIndicator } from '~/components/common/ReadIndicator'
9
10
import { useSetHeaderMetaInfo } from '~/components/layout/header/hooks'
10
11
import { Markdown } from '~/components/ui/markdown'
11
12
import { PostActionAside } from '~/components/widgets/post/PostActionAside'
13
+ import { PostCopyright } from '~/components/widgets/post/PostCopyright'
12
14
import { PostMetaBar } from '~/components/widgets/post/PostMetaBar'
13
15
import { SubscribeBell } from '~/components/widgets/subscribe/SubscribeBell'
14
16
import { TocAside , TocAutoScroll } from '~/components/widgets/toc'
@@ -21,6 +23,53 @@ import { WrappedElementProvider } from '~/providers/shared/WrappedElementProvide
21
23
22
24
import Loading from './loading'
23
25
26
+ const PostPage = ( ) => {
27
+ const id = useCurrentPostDataSelector ( ( p ) => p ?. id )
28
+ const title = useCurrentPostDataSelector ( ( p ) => p ?. title )
29
+ if ( ! id ) {
30
+ return < Loading />
31
+ }
32
+
33
+ return (
34
+ < div >
35
+ < HeaderMetaInfoSetting />
36
+ < article className = "prose" >
37
+ < header className = "mb-8" >
38
+ < h1 className = "text-center" >
39
+ < Balancer > { title } </ Balancer >
40
+ </ h1 >
41
+
42
+ < PostMetaBarInternal className = "mb-8 justify-center" />
43
+
44
+ < XLogSummaryForPost />
45
+ </ header >
46
+ < WrappedElementProvider >
47
+ < PostMarkdownImageRecordProvider >
48
+ < PostMarkdown />
49
+ </ PostMarkdownImageRecordProvider >
50
+
51
+ < LayoutRightSidePortal >
52
+ < TocAside
53
+ className = "sticky top-[120px] ml-4 mt-[120px]"
54
+ treeClassName = "max-h-[calc(100vh-6rem-4.5rem-300px)] h-[calc(100vh-6rem-4.5rem-300px)] min-h-[120px] relative"
55
+ accessory = { ReadIndicator }
56
+ >
57
+ < PostActionAside className = "translate-y-full" />
58
+ </ TocAside >
59
+ < TocAutoScroll />
60
+ </ LayoutRightSidePortal >
61
+ </ WrappedElementProvider >
62
+ </ article >
63
+
64
+ < ClientOnly >
65
+ < PostCopyright />
66
+ < SubscribeBell defaultType = "post_c" />
67
+ < XLogInfoForPost />
68
+ </ ClientOnly >
69
+ </ div >
70
+ )
71
+ }
72
+
24
73
const PostMarkdown = ( ) => {
25
74
const text = useCurrentPostDataSelector ( ( data ) => data ?. text )
26
75
if ( ! text ) return null
@@ -74,47 +123,5 @@ const PostMetaBarInternal: Component = ({ className }) => {
74
123
if ( ! meta ) return null
75
124
return < PostMetaBar meta = { meta } className = { className } />
76
125
}
77
- const PostPage = ( ) => {
78
- const id = useCurrentPostDataSelector ( ( p ) => p ?. id )
79
- const title = useCurrentPostDataSelector ( ( p ) => p ?. title )
80
- if ( ! id ) {
81
- return < Loading />
82
- }
83
126
84
- return (
85
- < div >
86
- < HeaderMetaInfoSetting />
87
- < article className = "prose" >
88
- < header className = "mb-8" >
89
- < h1 className = "text-center" >
90
- < Balancer > { title } </ Balancer >
91
- </ h1 >
92
-
93
- < PostMetaBarInternal className = "mb-8 justify-center" />
94
-
95
- < XLogSummaryForPost />
96
- </ header >
97
- < WrappedElementProvider >
98
- < PostMarkdownImageRecordProvider >
99
- < PostMarkdown />
100
- </ PostMarkdownImageRecordProvider >
101
-
102
- < LayoutRightSidePortal >
103
- < TocAside
104
- className = "sticky top-[120px] ml-4 mt-[120px]"
105
- treeClassName = "max-h-[calc(100vh-6rem-4.5rem-300px)] h-[calc(100vh-6rem-4.5rem-300px)] min-h-[120px] relative"
106
- accessory = { ReadIndicator }
107
- >
108
- < PostActionAside className = "translate-y-full" />
109
- </ TocAside >
110
- < TocAutoScroll />
111
- </ LayoutRightSidePortal >
112
- </ WrappedElementProvider >
113
- </ article >
114
-
115
- < SubscribeBell defaultType = "post_c" />
116
- < XLogInfoForPost />
117
- </ div >
118
- )
119
- }
120
127
export default PostPage
0 commit comments