添加页面可以隐藏评论的属性

This commit is contained in:
GreyAir
2024-05-27 08:25:08 +00:00
parent f0d7f82dcd
commit 86241e1525
2 changed files with 70 additions and 67 deletions

View File

@@ -121,82 +121,84 @@ const Comment = ({ frontMatter, className }) => {
return null
}
return (
<div
key={frontMatter?.id}
id='comment'
ref={commentRef}
className={`comment mt-5 text-gray-800 dark:text-gray-300 ${className || ''}`}>
{/* 延迟加载评论区 */}
{!shouldLoad && (
<div className='text-center'>
Loading...
<i className='fas fa-spinner animate-spin text-3xl ' />
</div>
)}
if (frontMatter?.comment != 'Hide') {
return (
<div
key={frontMatter?.id}
id='comment'
ref={commentRef}
className={`comment mt-5 text-gray-800 dark:text-gray-300 ${className || ''}`}>
{/* 延迟加载评论区 */}
{!shouldLoad && (
<div className='text-center'>
Loading...
<i className='fas fa-spinner animate-spin text-3xl ' />
</div>
)}
{shouldLoad && (
<Tabs>
{COMMENT_ARTALK_SERVER && (
<div key='Artalk'>
<Artalk />
</div>
)}
{shouldLoad && (
<Tabs>
{COMMENT_ARTALK_SERVER && (
<div key='Artalk'>
<Artalk />
</div>
)}
{COMMENT_TWIKOO_ENV_ID && (
<div key='Twikoo'>
<TwikooCompenent />
</div>
)}
{COMMENT_TWIKOO_ENV_ID && (
<div key='Twikoo'>
<TwikooCompenent />
</div>
)}
{COMMENT_WALINE_SERVER_URL && (
<div key='Waline'>
<WalineComponent />
</div>
)}
{COMMENT_WALINE_SERVER_URL && (
<div key='Waline'>
<WalineComponent />
</div>
)}
{COMMENT_VALINE_APP_ID && (
<div key='Valine' name='reply'>
<ValineComponent path={frontMatter.id} />
</div>
)}
{COMMENT_VALINE_APP_ID && (
<div key='Valine' name='reply'>
<ValineComponent path={frontMatter.id} />
</div>
)}
{COMMENT_GISCUS_REPO && (
<div key='Giscus'>
<GiscusComponent className='px-2' />
</div>
)}
{COMMENT_GISCUS_REPO && (
<div key='Giscus'>
<GiscusComponent className='px-2' />
</div>
)}
{COMMENT_CUSDIS_APP_ID && (
<div key='Cusdis'>
<CusdisComponent frontMatter={frontMatter} />
</div>
)}
{COMMENT_CUSDIS_APP_ID && (
<div key='Cusdis'>
<CusdisComponent frontMatter={frontMatter} />
</div>
)}
{COMMENT_UTTERRANCES_REPO && (
<div key='Utterance'>
<UtterancesComponent
issueTerm={frontMatter.id}
className='px-2'
/>
</div>
)}
{COMMENT_UTTERRANCES_REPO && (
<div key='Utterance'>
<UtterancesComponent
issueTerm={frontMatter.id}
className='px-2'
/>
</div>
)}
{COMMENT_GITALK_CLIENT_ID && (
<div key='GitTalk'>
<GitalkComponent frontMatter={frontMatter} />
</div>
)}
{COMMENT_GITALK_CLIENT_ID && (
<div key='GitTalk'>
<GitalkComponent frontMatter={frontMatter} />
</div>
)}
{COMMENT_WEBMENTION_ENABLE && (
<div key='WebMention'>
<WebMentionComponent frontMatter={frontMatter} className='px-2' />
</div>
)}
</Tabs>
)}
</div>
)
{COMMENT_WEBMENTION_ENABLE && (
<div key='WebMention'>
<WebMentionComponent frontMatter={frontMatter} className='px-2' />
</div>
)}
</Tabs>
)}
</div>
)
}
}
export default Comment

View File

@@ -94,6 +94,7 @@ export default async function getPageProperties(
properties.type = properties.type?.[0] || ''
properties.status = properties.status?.[0] || ''
properties.category = properties.category?.[0] || ''
properties.comment = properties.comment?.[0] || ''
// 映射值用户个性化type和status字段的下拉框选项在此映射回代码的英文标识
mapProperties(properties)