Skip to content

Commit

Permalink
Merge branch 'tangly1024:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
1208nn authored Nov 15, 2023
2 parents b9123cb + 2ebd3fd commit 1d37772
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 45 deletions.
92 changes: 51 additions & 41 deletions components/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ const ValineComponent = dynamic(() => import('@/components/ValineComponent'), {
const Comment = ({ siteInfo, frontMatter, className }) => {
const router = useRouter()

const COMMENT_ARTALK_SERVER = siteConfig('COMMENT_ARTALK_SERVER')
const COMMENT_TWIKOO_ENV_ID = siteConfig('COMMENT_TWIKOO_ENV_ID')
const COMMENT_WALINE_SERVER_URL = siteConfig('COMMENT_WALINE_SERVER_URL')
const COMMENT_VALINE_APP_ID = siteConfig('COMMENT_VALINE_APP_ID')
const COMMENT_GISCUS_REPO = siteConfig('COMMENT_GISCUS_REPO')
const COMMENT_CUSDIS_APP_ID = siteConfig('COMMENT_CUSDIS_APP_ID')
const COMMENT_UTTERRANCES_REPO = siteConfig('COMMENT_UTTERRANCES_REPO')
const COMMENT_GITALK_CLIENT_ID = siteConfig('COMMENT_GITALK_CLIENT_ID')
const COMMENT_WEBMENTION_ENABLE = siteConfig('COMMENT_WEBMENTION_ENABLE')

// 当连接中有特殊参数时跳转到评论区
if (isBrowser && ('giscus' in router.query || router.query.target === 'comment')) {
setTimeout(() => {
Expand All @@ -77,47 +87,47 @@ const Comment = ({ siteInfo, frontMatter, className }) => {
}

return (
<div key={frontMatter?.id} id='comment' className={`comment mt-5 text-gray-800 dark:text-gray-300 ${className || ''}`}>
<Tabs>
{siteConfig('COMMENT_ARTALK_SERVER') && (<div key='Artalk'>
<Artalk />
</div>)}

{siteConfig('COMMENT_TWIKOO_ENV_ID') && (<div key='Twikoo'>
<TwikooCompenent />
</div>)}

{siteConfig('COMMENT_WALINE_SERVER_URL') && (<div key='Waline'>
<WalineComponent />
</div>)}

{siteConfig('COMMENT_VALINE_APP_ID') && (<div key='Valine' name='reply'>
<ValineComponent path={frontMatter.id} />
</div>)}

{siteConfig('COMMENT_GISCUS_REPO') && (
<div key="Giscus">
<GiscusComponent className="px-2" />
</div>
)}

{siteConfig('COMMENT_CUSDIS_APP_ID') && (<div key='Cusdis'>
<CusdisComponent frontMatter={frontMatter} />
</div>)}

{siteConfig('COMMENT_UTTERRANCES_REPO') && (<div key='Utterance'>
<UtterancesComponent issueTerm={frontMatter.id} className='px-2' />
</div>)}

{siteConfig('COMMENT_GITALK_CLIENT_ID') && (<div key='GitTalk'>
<GitalkComponent frontMatter={frontMatter} />
</div>)}

{siteConfig('COMMENT_WEBMENTION_ENABLE') && (<div key='WebMention'>
<WebMentionComponent frontMatter={frontMatter} className="px-2" />
</div>)}
</Tabs>
</div>
<div key={frontMatter?.id} id='comment' className={`comment mt-5 text-gray-800 dark:text-gray-300 ${className || ''}`}>
<Tabs>
{COMMENT_ARTALK_SERVER && (<div key='Artalk'>
<Artalk />
</div>)}

{COMMENT_TWIKOO_ENV_ID && (<div key='Twikoo'>
<TwikooCompenent />
</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_GISCUS_REPO && (
<div key="Giscus">
<GiscusComponent className="px-2" />
</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_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>
)
}

Expand Down
2 changes: 1 addition & 1 deletion components/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Tabs = ({ className, children }) => {
return <></>
}

children = children.filter(c => c !== '')
children = children.filter(c => c && c !== '')

let count = 0
children.forEach(e => {
Expand Down
5 changes: 3 additions & 2 deletions themes/fukasawa/components/ArticleDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ArticleAround from './ArticleAround'
import { AdSlot } from '@/components/GoogleAdsense'
import LazyImage from '@/components/LazyImage'
import { formatDateFmt } from '@/lib/formatDate'
import WWAds from '@/components/WWAds'

/**
*
Expand Down Expand Up @@ -81,8 +82,7 @@ export default function ArticleDetail(props) {

</section>

<AdSlot type='in-article'/>

<WWAds className='w-full' orientation='horizontal'/>
</header>

{/* Notion文章主体 */}
Expand All @@ -91,6 +91,7 @@ export default function ArticleDetail(props) {
</section>

<section>
<AdSlot type='in-article'/>
{/* 分享 */}
<ShareBar post={post} />
</section>
Expand Down
6 changes: 5 additions & 1 deletion themes/fukasawa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Style } from './style'
import replaceSearchResult from '@/components/Mark'
import CommonHead from '@/components/CommonHead'
import { siteConfig } from '@/lib/config'
import WWAds from '@/components/WWAds'

const Live2D = dynamic(() => import('@/components/Live2D'))

Expand Down Expand Up @@ -124,7 +125,10 @@ const LayoutIndex = (props) => {
*/
const LayoutPostList = (props) => {
return <LayoutBase {...props}>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}

<div className='w-full p-2'><WWAds className='w-full' orientation='horizontal'/></div>

{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}
</LayoutBase>
}

Expand Down

0 comments on commit 1d37772

Please sign in to comment.