@@ -4,7 +4,13 @@ import Image from 'next/legacy/image'
4
4
import Link from 'next/link'
5
5
import { useRouter } from 'next/router'
6
6
import { type PageBlock } from 'notion-types'
7
- import { formatDate , getBlockTitle , getPageProperty } from 'notion-utils'
7
+ import {
8
+ formatDate ,
9
+ getBlockTitle ,
10
+ getPageProperty ,
11
+ normalizeTitle ,
12
+ parsePageId
13
+ } from 'notion-utils'
8
14
import * as React from 'react'
9
15
import BodyClassName from 'react-body-classname'
10
16
import {
@@ -80,15 +86,6 @@ const Collection = dynamic(() =>
80
86
( m ) => m . Collection
81
87
)
82
88
)
83
- const Equation = dynamic ( ( ) =>
84
- import ( 'react-notion-x/build/third-party/equation' ) . then ( ( m ) => m . Equation )
85
- )
86
- const Pdf = dynamic (
87
- ( ) => import ( 'react-notion-x/build/third-party/pdf' ) . then ( ( m ) => m . Pdf ) ,
88
- {
89
- ssr : false
90
- }
91
- )
92
89
const Modal = dynamic (
93
90
( ) =>
94
91
import ( 'react-notion-x/build/third-party/modal' ) . then ( ( m ) => {
@@ -152,11 +149,35 @@ const propertyTextValue = (
152
149
return defaultFn ( )
153
150
}
154
151
152
+ const propertySelectValue = (
153
+ { schema, value, key, pageHeader } ,
154
+ defaultFn : ( ) => React . ReactNode
155
+ ) => {
156
+ value = normalizeTitle ( value )
157
+
158
+ if ( pageHeader && schema . type === 'multi_select' && value ) {
159
+ return (
160
+ < Link href = { `/tags/${ value } ` } key = { key } >
161
+ < a > { defaultFn ( ) } </ a >
162
+ </ Link >
163
+ )
164
+ }
165
+
166
+ return defaultFn ( )
167
+ }
168
+
169
+ const HeroHeader = dynamic < { className ?: string } > (
170
+ ( ) => import ( './HeroHeader' ) . then ( ( m ) => m . HeroHeader ) ,
171
+ { ssr : false }
172
+ )
173
+
155
174
export function NotionPage ( {
156
175
site,
157
176
recordMap,
158
177
error,
159
- pageId
178
+ pageId,
179
+ tagsPage,
180
+ propertyToFilterName
160
181
} : types . PageProps ) {
161
182
const router = useRouter ( )
162
183
const lite = useSearchParam ( 'lite' )
@@ -167,14 +188,13 @@ export function NotionPage({
167
188
nextLink : Link ,
168
189
Code,
169
190
Collection,
170
- Equation,
171
- Pdf,
172
191
Modal,
173
192
Tweet,
174
193
Header : NotionPageHeader ,
175
194
propertyLastEditedTimeValue,
176
195
propertyTextValue,
177
- propertyDateValue
196
+ propertyDateValue,
197
+ propertySelectValue
178
198
} ) ,
179
199
[ ]
180
200
)
@@ -199,6 +219,8 @@ export function NotionPage({
199
219
// parsePageId(block?.id) === parsePageId(site?.rootNotionPageId)
200
220
const isBlogPost =
201
221
block ?. type === 'page' && block ?. parent_table === 'collection'
222
+ const isBioPage =
223
+ parsePageId ( block ?. id ) === parsePageId ( '8d0062776d0c4afca96eb1ace93a7538' )
202
224
203
225
const showTableOfContents = ! ! isBlogPost
204
226
const minTableOfContentsItems = 3
@@ -212,6 +234,16 @@ export function NotionPage({
212
234
213
235
const footer = React . useMemo ( ( ) => < Footer /> , [ ] )
214
236
237
+ const pageCover = React . useMemo ( ( ) => {
238
+ if ( isBioPage ) {
239
+ return (
240
+ < HeroHeader className = 'notion-page-cover-wrapper notion-page-cover-hero' />
241
+ )
242
+ } else {
243
+ return null
244
+ }
245
+ } , [ isBioPage ] )
246
+
215
247
if ( router . isFallback ) {
216
248
return < Loading />
217
249
}
@@ -220,7 +252,9 @@ export function NotionPage({
220
252
return < Page404 site = { site } pageId = { pageId } error = { error } />
221
253
}
222
254
223
- const title = getBlockTitle ( block , recordMap ) || site . name
255
+ const name = getBlockTitle ( block , recordMap ) || site . name
256
+ const title =
257
+ tagsPage && propertyToFilterName ? `${ propertyToFilterName } ${ name } ` : name
224
258
225
259
console . log ( 'notion page' , {
226
260
isDev : config . isDev ,
@@ -269,7 +303,8 @@ export function NotionPage({
269
303
< NotionRenderer
270
304
bodyClassName = { cs (
271
305
styles . notion ,
272
- pageId === site . rootNotionPageId && 'index-page'
306
+ pageId === site . rootNotionPageId && 'index-page' ,
307
+ tagsPage && 'tags-page'
273
308
) }
274
309
darkMode = { isDarkMode }
275
310
components = { components }
@@ -284,11 +319,14 @@ export function NotionPage({
284
319
defaultPageIcon = { config . defaultPageIcon }
285
320
defaultPageCover = { config . defaultPageCover }
286
321
defaultPageCoverPosition = { config . defaultPageCoverPosition }
322
+ linkTableTitleProperties = { false }
287
323
mapPageUrl = { siteMapPageUrl }
288
324
mapImageUrl = { mapImageUrl }
289
325
searchNotion = { config . isSearchEnabled ? searchNotion : null }
290
326
pageAside = { pageAside }
291
327
footer = { footer }
328
+ pageTitle = { tagsPage && propertyToFilterName ? title : undefined }
329
+ pageCover = { pageCover }
292
330
/>
293
331
294
332
< GitHubShareButton />
0 commit comments