import { getPageTableOfContents } from 'notion-utils' import { useRef } from 'react' import { ArticleLock } from './components/ArticleLock' import HeaderArticle from './components/HeaderArticle' import JumpToCommentButton from './components/JumpToCommentButton' import TocDrawer from './components/TocDrawer' import TocDrawerButton from './components/TocDrawerButton' import LayoutBase from './LayoutBase' import Comment from '@/components/Comment' import NotionPage from '@/components/NotionPage' import ArticleAdjacent from './components/ArticleAdjacent' import ArticleCopyright from './components/ArticleCopyright' import ArticleRecommend from './components/ArticleRecommend' import { isBrowser } from '@/lib/utils' export const LayoutSlug = props => { const { post, lock, validPassword } = props if (!post) { return } {...props} showCategory={false} showTag={false} > } if (!lock && post?.blockMap?.block) { post.content = Object.keys(post.blockMap.block) post.toc = getPageTableOfContents(post, post.blockMap) } const drawerRight = useRef(null) const targetRef = isBrowser() ? document.getElementById('container') : null const floatSlot = <> {post?.toc?.length > 1 &&
{ drawerRight?.current?.handleSwitchVisible() }} />
} return ( } {...props} showCategory={false} showTag={false} floatSlot={floatSlot} >
{lock && } {!lock &&
{/* Notion文章主体 */}
{post && }
{/* 文章内嵌广告 */}
{post.type === 'Post' && } {post.type === 'Post' && } {post.type === 'Post' && }

{/* 评论互动 */}
}
) }