@@ -43,7 +43,7 @@ export const Thread = ({ threadData }: { threadData: TThread }) => {
4343 return (
4444 < Link
4545 href = { `/post/${ threadData . _id } ` }
46- className = { style . thread + " cursor-pointer select-none " }
46+ className = { style . thread + " cursor-pointer select-none" }
4747 style = { {
4848 backgroundColor : isAnnouncement ? "white" : "" ,
4949 } }
@@ -62,11 +62,7 @@ export const Thread = ({ threadData }: { threadData: TThread }) => {
6262 </ div >
6363 < div className = { style . statist } >
6464 < p className = { style . date } >
65- {
66- new Date ( threadData . createdAt ! )
67- . toLocaleString ( "zh-TW" )
68- . split ( " " ) [ 0 ]
69- }
65+ { new Date ( threadData . createdAt ! ) . toLocaleString ( "zh-TW" ) . split ( " " ) [ 0 ] }
7066 </ p >
7167 < div className = { style . likes } >
7268 < Image
@@ -90,11 +86,11 @@ export const Thread = ({ threadData }: { threadData: TThread }) => {
9086 </ div >
9187 </ div >
9288 </ div >
89+
9390 < div className = { style . title_bar } >
9491 < h1 className = { style . previewTitle } >
9592 { isAnnouncement && "🔔 公告 - " }
9693 { threadData . title }
97- { /* {threadData.pinned && " • 已置頂"} */ }
9894 </ h1 >
9995 </ div >
10096
@@ -106,21 +102,34 @@ export const Thread = ({ threadData }: { threadData: TThread }) => {
106102 >
107103 { markdownToPlainText ( threadData . content ) }
108104 </ p >
105+
106+ { threadData . hashtag && threadData . hashtag . length > 0 && ! isAnnouncement && (
107+ < div className = { style . hashtags } >
108+ { threadData . hashtag . slice ( 0 , 3 ) . map ( ( tag , index ) => (
109+ < span key = { index } className = { style . hashtag } >
110+ #{ tag }
111+ </ span >
112+ ) ) }
113+ </ div >
114+ ) }
109115 </ div >
116+
110117 < div
111118 className = { style . cover }
112119 style = { {
113120 display : isAnnouncement ? "none" : "" ,
114121 } }
115122 >
116- < Image
117- src = { fixCoverUrl ( threadData . cover ! ) }
118- alt = "cover image"
119- style = { { objectFit : "cover" } }
120- priority
121- sizes = "100%"
122- fill
123- > </ Image >
123+ { threadData . cover && (
124+ < Image
125+ src = { fixCoverUrl ( threadData . cover ) }
126+ alt = "cover image"
127+ style = { { objectFit : "cover" } }
128+ priority
129+ sizes = "100%"
130+ fill
131+ />
132+ ) }
124133 </ div >
125134 </ Link >
126135 ) ;
@@ -137,6 +146,11 @@ const ThreadSkeleton = () => {
137146 </ div >
138147 < div className = { skeleton . title } > </ div >
139148 < p className = { skeleton . content } > </ p >
149+ < div className = { skeleton . hashtags } >
150+ < div className = { skeleton . hashtag } > </ div >
151+ < div className = { skeleton . hashtag } > </ div >
152+ < div className = { skeleton . hashtag } > </ div >
153+ </ div >
140154 </ div >
141155 < div className = { skeleton . cover } > </ div >
142156 </ div >
0 commit comments