From 9ddad487ec53a5104ec2f0548467ce399404ac78 Mon Sep 17 00:00:00 2001 From: tangly Date: Thu, 20 Oct 2022 12:50:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=B8=89=E7=BA=A7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=B0=8F=E5=86=99=E7=BD=97=E9=A9=AC=E5=AD=97?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- styles/notion.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/styles/notion.css b/styles/notion.css index f6a28c5b..9c143e5b 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -657,6 +657,10 @@ svg.notion-page-icon { list-style-type: lower-alpha; } +.notion-list-numbered > .notion-list-numbered > .notion-list-numbered { + list-style-type: lower-roman; + } + .notion-list-disc li { padding-left: 0.1em; } From cd233f506035778c5694aabae320a297d466854b Mon Sep 17 00:00:00 2001 From: tangly Date: Thu, 20 Oct 2022 13:01:32 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 2 +- pages/[...slug].js | 2 +- pages/archive/index.js | 2 +- pages/category/[category].js | 2 +- pages/index.js | 2 +- pages/page/[page].js | 2 +- pages/search/[keyword].js | 2 +- pages/search/index.js | 2 +- pages/tag/[tag].js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 21a43c37..c74552cb 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -257,7 +257,7 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { let postCount = 0 const allPages = collectionData.filter(post => { - if (post.type === 'Post' && (post.status === 'Published' || post.status === 'Invisible')) { + if (post.type === 'Post' && post.status === 'Published') { postCount++ } diff --git a/pages/[...slug].js b/pages/[...slug].js index 015f053f..97327526 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -98,7 +98,7 @@ export async function getStaticProps({ params: { slug } }) { // slug 是个数组 const fullSlug = slug.join('/') const from = `slug-props-${fullSlug}` - const props = await getGlobalNotionData({ from, pageType: ['Post'] }) + const props = await getGlobalNotionData({ from }) props.post = props.allPages.find((p) => { return p.slug === fullSlug || p.id === idToUuid(fullSlug) }) diff --git a/pages/archive/index.js b/pages/archive/index.js index 098da940..ed40b48a 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -21,7 +21,7 @@ const ArchiveIndex = props => { export async function getStaticProps() { const props = await getGlobalNotionData({ from: 'archive-index' }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') // 处理分页 props.posts = allPosts return { diff --git a/pages/category/[category].js b/pages/category/[category].js index 6c07adcf..6082c336 100644 --- a/pages/category/[category].js +++ b/pages/category/[category].js @@ -27,7 +27,7 @@ export async function getStaticProps({ params: { category } }) { const from = 'category-props' let props = await getGlobalNotionData({ from }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') const posts = allPosts.filter( post => post && post.category && post.category.includes(category) ) diff --git a/pages/index.js b/pages/index.js index 3c49f983..92a70474 100644 --- a/pages/index.js +++ b/pages/index.js @@ -13,7 +13,7 @@ export async function getStaticProps() { const from = 'index' const props = await getGlobalNotionData({ from }) const { allPages, siteInfo } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') const meta = { title: `${siteInfo?.title} | ${siteInfo?.description}`, description: siteInfo?.description, diff --git a/pages/page/[page].js b/pages/page/[page].js index a7b49e82..a09f08d1 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -39,7 +39,7 @@ export async function getStaticProps({ params: { page } }) { const props = await getGlobalNotionData({ from }) props.page = page const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') // 处理分页 props.posts = allPosts.slice( BLOG.POSTS_PER_PAGE * (page - 1), diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index dc992481..e478920d 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -36,7 +36,7 @@ export async function getStaticProps({ params: { keyword } }) { pageType: ['Post'] }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = await filterByMemCache(allPosts, keyword) props.keyword = keyword return { diff --git a/pages/search/index.js b/pages/search/index.js index 7cee6392..4dd96ad5 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -53,7 +53,7 @@ export async function getStaticProps() { pageType: ['Post'] }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = allPosts return { props, diff --git a/pages/tag/[tag].js b/pages/tag/[tag].js index 37606158..875a8768 100644 --- a/pages/tag/[tag].js +++ b/pages/tag/[tag].js @@ -29,7 +29,7 @@ export async function getStaticProps({ params: { tag } }) { tagsCount: 0 }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = allPosts.filter( post => post && post.tags && post.tags.includes(tag) ) From 99eacc0fd43401d5e4e6be94caa376e239877787 Mon Sep 17 00:00:00 2001 From: tangly Date: Thu, 20 Oct 2022 14:44:08 +0800 Subject: [PATCH 3/6] =?UTF-8?q?Next=20=E4=B8=BB=E9=A2=98=E6=8C=89=E9=92=AE?= =?UTF-8?q?=20=E5=85=BC=E5=AE=B9FaceBookMessenger=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/LayoutBase.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/themes/next/LayoutBase.js b/themes/next/LayoutBase.js index 7f64181b..76f56dc8 100644 --- a/themes/next/LayoutBase.js +++ b/themes/next/LayoutBase.js @@ -9,7 +9,7 @@ import SideAreaRight from './components/SideAreaRight' import TopNav from './components/TopNav' import { useGlobal } from '@/lib/global' import PropTypes from 'prop-types' -import React, { useEffect, useRef, useState } from 'react' +import React from 'react' import smoothscroll from 'smoothscroll-polyfill' import CONFIG_NEXT from './config_next' import Live2D from '@/components/Live2D' @@ -22,11 +22,12 @@ import Live2D from '@/components/Live2D' const LayoutBase = (props) => { const { children, headerSlot, meta, sideBarSlot, floatSlot, rightAreaSlot, siteInfo } = props const { onLoading } = useGlobal() - const targetRef = useRef(null) + const targetRef = React.useRef(null) + const floatButtonGroup = React.useRef(null) const leftAreaSlot = - const [show, switchShow] = useState(false) - const [percent, changePercent] = useState(0) // 页面阅读百分比 + const [show, switchShow] = React.useState(false) + const [percent, changePercent] = React.useState(0) // 页面阅读百分比 const scrollListener = () => { const targetRef = document.getElementById('wrapper') const clientHeight = targetRef?.clientHeight @@ -41,8 +42,18 @@ const LayoutBase = (props) => { } changePercent(per) } - useEffect(() => { + + React.useEffect(() => { smoothscroll.polyfill() + + // facebook messenger 插件需要调整右下角悬浮按钮的高度 + const fb = document.getElementsByClassName('fb-customerchat') + if (fb.length === 0) { + floatButtonGroup?.current?.classList.replace('bottom-24', 'bottom-12') + } else { + floatButtonGroup?.current?.classList.remove('bottom-12', 'bottom-24') + } + document.addEventListener('scroll', scrollListener) return () => document.removeEventListener('scroll', scrollListener) }, [show]) @@ -66,7 +77,7 @@ const LayoutBase = (props) => { {/* 右下角悬浮 */} -
+
From c1dc380d91a5bcd844806671161aaab8e422a99c Mon Sep 17 00:00:00 2001 From: wb_guodonghao Date: Fri, 21 Oct 2022 14:33:09 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E5=A6=82=E4=BD=A0=E6=89=80=E8=A7=81?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=E4=BA=86=E6=88=91=E7=9A=84=E5=90=8D?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0eae28b5..fffcc637 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ yarn run start # 本地启动NextJS服务 haixin1225
haixin1225

🔧 🐛 - mouyase
haixin1225

🔧 🐛 + mouyase
mouyase

🔧 🐛 From 2acd5cc58a7ce04de40c8bf18153e872f7245eb0 Mon Sep 17 00:00:00 2001 From: tangly Date: Fri, 21 Oct 2022 14:37:16 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnext=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/LayoutBase.js | 5 +++-- themes/next/components/SideAreaRight.js | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/themes/next/LayoutBase.js b/themes/next/LayoutBase.js index 76f56dc8..f3b9dc44 100644 --- a/themes/next/LayoutBase.js +++ b/themes/next/LayoutBase.js @@ -51,7 +51,7 @@ const LayoutBase = (props) => { if (fb.length === 0) { floatButtonGroup?.current?.classList.replace('bottom-24', 'bottom-12') } else { - floatButtonGroup?.current?.classList.remove('bottom-12', 'bottom-24') + floatButtonGroup?.current?.classList.replace('bottom-12', 'bottom-24') } document.addEventListener('scroll', scrollListener) @@ -73,7 +73,8 @@ const LayoutBase = (props) => {
{onLoading ? : <> {children} }
- + {/* 右侧栏样式 */} + { CONFIG_NEXT.RIGHT_BAR && } {/* 右下角悬浮 */} diff --git a/themes/next/components/SideAreaRight.js b/themes/next/components/SideAreaRight.js index 6a0abd51..d5ccfe15 100644 --- a/themes/next/components/SideAreaRight.js +++ b/themes/next/components/SideAreaRight.js @@ -22,9 +22,6 @@ import BLOG from '@/blog.config' const SideAreaRight = (props) => { const { tags, currentTag, slot, categories, currentCategory } = props const { locale } = useGlobal() - if (!CONFIG_NEXT.RIGHT_BAR) { - return <> - } const router = useRouter() return (