@@ -21,6 +21,48 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
2121 } ;
2222}
2323
24+ function renderGuideBody ( body : string ) {
25+ return body
26+ . split ( "\n" )
27+ . map ( ( line ) => line . trim ( ) )
28+ . filter ( Boolean )
29+ . map ( ( line , index ) => {
30+ if ( line . startsWith ( "#### " ) ) {
31+ return (
32+ < h3 className = "guide-inline-heading" key = { `${ index } -${ line } ` } >
33+ { line . replace ( / ^ # # # # / , "" ) }
34+ </ h3 >
35+ ) ;
36+ }
37+
38+ if ( line . startsWith ( "### " ) ) {
39+ return (
40+ < h2 className = "guide-section-heading" key = { `${ index } -${ line } ` } >
41+ { line . replace ( / ^ # # # / , "" ) }
42+ </ h2 >
43+ ) ;
44+ }
45+
46+ if ( line . startsWith ( "**" ) && line . endsWith ( "**" ) ) {
47+ return (
48+ < p className = "guide-callout" key = { `${ index } -${ line } ` } >
49+ { line . replace ( / ^ \* \* / , "" ) . replace ( / \* \* $ / , "" ) }
50+ </ p >
51+ ) ;
52+ }
53+
54+ if ( line . startsWith ( "👉 " ) ) {
55+ return (
56+ < p className = "guide-action" key = { `${ index } -${ line } ` } >
57+ { line . replace ( / ^ 👉 / , "" ) }
58+ </ p >
59+ ) ;
60+ }
61+
62+ return < p key = { `${ index } -${ line } ` } > { line } </ p > ;
63+ } ) ;
64+ }
65+
2466export default async function GuideDetailPage ( { params } : Props ) {
2567 const { slug } = await params ;
2668 const guide = guides . find ( ( item ) => item . slug === slug ) ;
@@ -40,10 +82,15 @@ export default async function GuideDetailPage({ params }: Props) {
4082 < div className = "detail-copy" >
4183 < p className = "eyebrow" > { categoryLabel } </ p >
4284 < h1 > { guide . title } </ h1 >
43- < p className = "hero-text" > { guide . body } </ p >
85+ < p className = "hero-text" > { guide . summary } </ p >
4486 </ div >
4587 </ section >
4688 < section className = "detail-content single-column" >
89+ < article className = "detail-block guide-prose" >
90+ < p className = "eyebrow" > 正文</ p >
91+ < h2 > 先把决策顺序想清楚</ h2 >
92+ { renderGuideBody ( guide . body ) }
93+ </ article >
4794 < article className = "detail-block" >
4895 < p className = "eyebrow" > 重点速记</ p >
4996 < h2 > 重点记住</ h2 >
@@ -154,6 +201,19 @@ export default async function GuideDetailPage({ params }: Props) {
154201 </ div >
155202 </ article >
156203 ) : null }
204+ { guide . practical ?. links ?. length ? (
205+ < article className = "detail-block" >
206+ < p className = "eyebrow" > 继续阅读</ p >
207+ < h2 > 相关页面</ h2 >
208+ < div className = "link-row" >
209+ { guide . practical . links . map ( ( item ) => (
210+ < a className = "ticket-link" href = { item . href } key = { item . href } >
211+ { item . label }
212+ </ a >
213+ ) ) }
214+ </ div >
215+ </ article >
216+ ) : null }
157217 </ section >
158218 </ main >
159219 ) ;
0 commit comments