Skip to content

Commit

Permalink
Merge pull request #3013 from tangly1024/release/4.7.11
Browse files Browse the repository at this point in the history
Release/4.7.11
  • Loading branch information
tangly1024 authored Nov 23, 2024
2 parents be1ada5 + 668b3c7 commit fac33c4
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 74 deletions.
3 changes: 3 additions & 0 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ export function getQueryVariable(key) {
* @returns {string|null}
*/
export function getQueryParam(url, param) {
if (!url) {
return ''
}
// 移除哈希部分
const urlWithoutHash = url.split('#')[0]
const searchParams = new URLSearchParams(urlWithoutHash.split('?')[1])
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "4.7.10",
"version": "4.7.11",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {
Expand Down
4 changes: 1 addition & 3 deletions pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 404
* @param {*} props
* @returns
*/
const NoFound = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='Layout404' {...props} />
}

export async function getStaticProps(req) {
Expand Down
2 changes: 1 addition & 1 deletion pages/[prefix]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Slug = props => {
return (
<>
{/* 文章布局 */}
<DynamicLayout theme={theme} router={router} {...props} />
<DynamicLayout theme={theme} layoutName='LayoutSlug' {...props} />
{/* 解锁密码提示框 */}
{post?.password && post?.password !== '' && !lock && <Notification />}
{/* 导流工具 */}
Expand Down
8 changes: 4 additions & 4 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'react-notion-x/src/styles.css' // 原版的react-notion-x

import useAdjustStyle from '@/hooks/useAdjustStyle'
import { GlobalContextProvider } from '@/lib/global'
import { getGlobalLayoutByTheme } from '@/themes/theme'
import { getBaseLayoutByTheme } from '@/themes/theme'
import { useRouter } from 'next/router'
import { useCallback, useMemo } from 'react'
import { getQueryParam } from '../lib/utils'
Expand All @@ -34,7 +34,7 @@ const MyApp = ({ Component, pageProps }) => {
useAdjustStyle()

const route = useRouter()
const queryParam = useMemo(() => {
const theme = useMemo(() => {
return (
getQueryParam(route.asPath, 'theme') ||
pageProps?.NOTION_CONFIG?.THEME ||
Expand All @@ -45,10 +45,10 @@ const MyApp = ({ Component, pageProps }) => {
// 整体布局
const GLayout = useCallback(
props => {
const Layout = getGlobalLayoutByTheme(queryParam)
const Layout = getBaseLayoutByTheme(theme)
return <Layout {...props} />
},
[queryParam]
[theme]
)

const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
Expand Down
4 changes: 1 addition & 3 deletions pages/archive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getGlobalData } from '@/lib/db/getSiteData'
import { isBrowser } from '@/lib/utils'
import { formatDateFmt } from '@/lib/utils/formatDate'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'
import { useEffect } from 'react'

/**
Expand All @@ -27,9 +26,8 @@ const ArchiveIndex = props => {
}
}, [])

const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutArchive' {...props} />
}

export async function getStaticProps({ locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/category/[category]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 分类页
* @param {*} props
* @returns
*/
export default function Category(props) {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps({ params: { category }, locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/category/[category]/page/[page].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 分类页
Expand All @@ -11,9 +10,8 @@ import { useRouter } from 'next/router'
*/

export default function Category(props) {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps({ params: { category, page } }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 分类首页
* @param {*} props
* @returns
*/
export default function Category(props) {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps({ locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/dashboard/[[...index]].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData, getPost, getPostBlocks } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 根据notion的slug访问页面
Expand All @@ -11,9 +10,8 @@ import { useRouter } from 'next/router'
* @returns
*/
const Dashboard = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutDashboard' {...props} />
}

export async function getStaticProps({ locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import { generateRobotsTxt } from '@/lib/robots.txt'
import { generateRss } from '@/lib/rss'
import { generateSitemapXml } from '@/lib/sitemap.xml'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 首页布局
* @param {*} props
* @returns
*/
const Index = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutIndex' {...props} />
}

/**
Expand Down
4 changes: 1 addition & 3 deletions pages/page/[page].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData, getPostBlocks } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 文章列表分页
* @param {*} props
* @returns
*/
const Page = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticPaths({ locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/search/[keyword]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { getDataFromCache } from '@/lib/cache/cache_manager'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

const Index = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutSearch' {...props} />
}

/**
Expand Down
4 changes: 1 addition & 3 deletions pages/search/[keyword]/page/[page].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import { getDataFromCache } from '@/lib/cache/cache_manager'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

const Index = props => {
const { keyword } = props
props = { ...props, currentSearch: keyword }

const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutSearch' {...props} />
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pages/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Search = props => {
props = { ...props, posts: filteredPosts }

const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutSearch' {...props} />
}

/**
Expand Down
4 changes: 1 addition & 3 deletions pages/sign-in/[[...index]].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
// import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 登录
* @param {*} props
* @returns
*/
const SignIn = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutSignIn' {...props} />
}

export async function getStaticProps(req) {
Expand Down
4 changes: 1 addition & 3 deletions pages/sign-up/[[...index]].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 注册
* @param {*} props
* @returns
*/
const SignUp = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutSignUp' {...props} />
}

export async function getStaticProps(req) {
Expand Down
4 changes: 1 addition & 3 deletions pages/tag/[tag]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

/**
* 标签下的文章列表
* @param {*} props
* @returns
*/
const Tag = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps({ params: { tag }, locale }) {
Expand Down
4 changes: 1 addition & 3 deletions pages/tag/[tag]/page/[page].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'

const Tag = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps({ params: { tag, page }, locale }) {
Expand Down
2 changes: 1 addition & 1 deletion pages/tag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useRouter } from 'next/router'
const TagIndex = props => {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
return <DynamicLayout theme={theme} layoutName='LayoutPostList' {...props} />
}

export async function getStaticProps(req) {
Expand Down
2 changes: 2 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ html {
position: sticky;
z-index: 10;
top: -1px;
-webkit-backdrop-filter: blur(5px);
backdrop-filter: blur(5px);
transition: all 0.5s cubic-bezier(0.4, 0, 0, 1);
border-bottom-color: transparent;
Expand Down Expand Up @@ -74,6 +75,7 @@ nav {

@supports not (backdrop-filter: none) {
.sticky-nav {
-webkit-backdrop-filter: none;
backdrop-filter: none;
@apply bg-day dark:bg-gray-800;
}
Expand Down
Loading

0 comments on commit fac33c4

Please sign in to comment.