import { getPageTableOfContents } from 'notion-utils' import LayoutBase from './LayoutBase' import { ArticleLock } from './components/ArticleLock' import NotionPage from '@/components/NotionPage' import Link from 'next/link' import { useGlobal } from '@/lib/global' import formatDate from '@/lib/formatDate' export const LayoutSlug = props => { const { post, lock, validPassword } = props if (!post) { return } if (!lock && post?.blockMap?.block) { post.content = Object.keys(post.blockMap.block) post.toc = getPageTableOfContents(post, post.blockMap) } const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE) return ( {post?.title} {lock && } {!lock && {post.category} | {post?.type[0] !== 'Page' && (<> {date} | {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} | >)} {post && } } ) }