Merge branch 'tangly1024:main' into main

This commit is contained in:
ShH Y
2023-12-15 22:52:00 +08:00
committed by GitHub
20 changed files with 52 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=4.1.1
NEXT_PUBLIC_VERSION=4.1.2
# 可在此添加环境变量,去掉最左边的(# )注释即可

View File

@@ -324,6 +324,10 @@ const BLOG = {
ANALYTICS_CNZZ_ID: process.env.NEXT_PUBLIC_ANALYTICS_CNZZ_ID || '', // 只需要填写站长统计的id, [cnzz_id] -> https://s9.cnzz.com/z_stat.php?id=[cnzz_id]&web_id=[cnzz_id]
ANALYTICS_GOOGLE_ID: process.env.NEXT_PUBLIC_ANALYTICS_GOOGLE_ID || '', // 谷歌Analytics的id e.g: G-XXXXXXXXXX
// 51la 站点统计 https://www.51.la/
ANALYTICS_51LA_ID: process.env.NEXT_PUBLIC_ANALYTICS_51LA_ID || '', // id在51la后台获取 参阅 https://docs.tangly1024.com/article/notion-next-51-la
ANALYTICS_51LA_CK: process.env.NEXT_PUBLIC_ANALYTICS_51LA_CK || '', // ck在51la后台获取
// Matomo 网站统计
MATOMO_HOST_URL: process.env.NEXT_PUBLIC_MATOMO_HOST_URL || '', // Matomo服务器地址不带斜杠
MATOMO_SITE_ID: process.env.NEXT_PUBLIC_MATOMO_SITE_ID || '', // Matomo网站ID
@@ -405,7 +409,7 @@ const BLOG = {
DEBUG: process.env.NEXT_PUBLIC_DEBUG || false, // 是否显示调试按钮
ENABLE_CACHE: process.env.ENABLE_CACHE || process.env.npm_lifecycle_event === 'build', // 缓存在开发调试和打包过程中选择性开启,正式部署开启此功能意义不大。
isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || true, // 编译时是否展示内容
BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小
VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号
}

View File

@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
import dynamic from 'next/dynamic'
import LA51 from './LA51'
import WebWhiz from './Webwhiz'
const TwikooCommentCounter = dynamic(() => import('@/components/TwikooCommentCounter'), { ssr: false })
@@ -66,6 +67,8 @@ const ExternalPlugin = (props) => {
const ANALYTICS_GOOGLE_ID = siteConfig('ANALYTICS_GOOGLE_ID')
const MATOMO_HOST_URL = siteConfig('MATOMO_HOST_URL')
const MATOMO_SITE_ID = siteConfig('MATOMO_SITE_ID')
const ANALYTICS_51LA_ID = siteConfig('ANALYTICS_51LA_ID')
const ANALYTICS_51LA_CK = siteConfig('ANALYTICS_51LA_CK')
if (DISABLE_PLUGIN) {
return null
@@ -95,6 +98,16 @@ const ExternalPlugin = (props) => {
<VConsole />
<LoadingProgress />
<AosAnimation />
{ANALYTICS_51LA_ID && ANALYTICS_51LA_CK && <LA51/>}
{ANALYTICS_51LA_ID && ANALYTICS_51LA_CK && (<>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js" defer/>
{/* <script async dangerouslySetInnerHTML={{
__html: `
LA.init({id:"${ANALYTICS_51LA_ID}",ck:"${ANALYTICS_51LA_CK}",hashMode:true,autoTrack:true})
`
}} /> */}
</>)}
{CHATBASE_ID && (<>
<script id={CHATBASE_ID} src="https://www.chatbase.co/embed.min.js" defer />

18
components/LA51.js Normal file
View File

@@ -0,0 +1,18 @@
import { siteConfig } from '@/lib/config'
import { useEffect } from 'react'
/**
* 51LA统计
*/
export default function LA51() {
const ANALYTICS_51LA_ID = siteConfig('ANALYTICS_51LA_ID')
const ANALYTICS_51LA_CK = siteConfig('ANALYTICS_51LA_CK')
useEffect(() => {
const LA = window.LA
if (LA) {
LA.init({ id: `${ANALYTICS_51LA_ID}`, ck: `${ANALYTICS_51LA_CK}`, hashMode: true, autoTrack: true })
}
}, [])
return <></>
}

View File

@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "4.1.1",
"version": "4.1.2",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {

View File

@@ -36,8 +36,7 @@ export const Nav = (props) => {
<nav className="w-full bg-white md:pt-0 px-6 relative z-20 border-t border-b border-gray-light dark:border-hexo-black-gray dark:bg-black">
<div className="container mx-auto max-w-4xl md:flex justify-between items-center text-sm md:text-md md:justify-start">
<ul className="w-full text-center md:text-left flex flex-wrap justify-center items-stretch md:justify-start md:items-start">
{/* {links.map(link => <NormalMenuItem key={link?.id} link={link}/>)} */}
{links.map(link => <MenuItemDrop key={link?.id} link={link} />)}
{links.map((link, index) => <MenuItemDrop key={index} link={link} />)}
</ul>
{/* <div className="w-full md:w-1/3 text-center md:text-right"> */}
{/* <!-- extra links --> */}

View File

@@ -30,9 +30,7 @@ export const MenuBarMobile = (props) => {
return (
<nav id='nav' className=' text-md'>
{/* {links.map(link => <NormalMenu key={link?.id} link={link}/>)} */}
{links?.map((link, index) => <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link}/>)}
</nav>
)
}

View File

@@ -18,7 +18,6 @@ export function InfoCard(props) {
const router = useRouter()
// 在文章详情页特殊处理
const isSlugPage = router.pathname.indexOf('/[prefix]') === 0
console.log('TITLE:', siteConfig('TITLE'))
return (
<Card className='bg-[#4f65f0] dark:bg-yellow-600 text-white flex flex-col w-72 overflow-hidden relative'>
{/* 信息卡牌第一行 */}

View File

@@ -29,8 +29,7 @@ export const MenuListSide = (props) => {
return (
<nav className='flex-col space-y-2'>
{/* {links.map(link => <MenuItemNormal key={link?.id} link={link} />)} */}
{links?.map(link => <MenuItemCollapse key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemCollapse key={index} link={link} />)}
</nav>
)
}

View File

@@ -35,8 +35,7 @@ export const MenuListSide = (props) => {
return (
<nav>
{/* {links.map(link => <MenuItemNormal key={link?.id} link={link} />)} */}
{links?.map(link => <MenuItemCollapse key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemCollapse key={index} link={link} />)}
</nav>
)
}

View File

@@ -36,7 +36,7 @@ export const MenuListTop = (props) => {
return (<>
<nav id='nav-mobile' className='leading-8 justify-center font-light w-full flex'>
{links?.map(link => link && link.show && <MenuItemDrop key={link?.id} link={link} />)}
{links?.map((link, index) => link && link.show && <MenuItemDrop key={index} link={link} />)}
</nav>
</>)
}

View File

@@ -29,8 +29,7 @@ export const MenuListSide = (props) => {
return (
<nav>
{/* {links.map(link => <MenuItemNormal key={link?.id} link={link} />)} */}
{links?.map(link => <MenuItemCollapse key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemCollapse key={index} link={link} />)}
</nav>
)
}

View File

@@ -29,7 +29,7 @@ export const MenuListTop = (props) => {
return (
<nav id='nav' className='leading-8 flex justify-center font-light w-full'>
{links?.map(link => <MenuItemDrop key={link?.id} link={link}/>)}
{links?.map((link, index) => <MenuItemDrop key={index} link={link}/>)}
</nav>
)
}

View File

@@ -30,8 +30,7 @@ export const MenuBarMobile = (props) => {
return (
<nav id='nav' className=' text-md'>
{/* {links.map(link => <NormalMenu key={link?.id} link={link}/>)} */}
{links?.map(link => <MenuItemCollapse onHeightChange={props.onHeightChange} key={link?.id} link={link}/>)}
{links?.map((link, index) => <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link}/>)}
</nav>
)

View File

@@ -66,7 +66,7 @@ export default function TopNavBar(props) {
{/* 桌面端顶部菜单 */}
<div className='hidden md:flex'>
{links && links?.map(link => <MenuItemDrop key={link?.id} link={link}/>)}
{links && links?.map((link, index) => <MenuItemDrop key={index} link={link}/>)}
</div>
</div>
</div>

View File

@@ -35,9 +35,7 @@ export const MenuBarMobile = (props) => {
return (
<nav id='nav' className=' text-md'>
{/* {links.map(link => <NormalMenu key={link?.id} link={link}/>)} */}
{links?.map((link, index) => <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link}/>)}
</nav>
)
}

View File

@@ -24,7 +24,7 @@ export const MenuItem = ({ link }) => {
{/* 菜单 */}
<div
onClick={toggleOpenSubMenu}
className='nav-menu dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-sm text-gray w-full items-center duration-300 pt-2 font-light select-none flex justify-between cursor-pointer' key={link?.name}>
className='nav-menu dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-sm text-gray w-full items-center duration-300 pt-2 font-light select-none flex justify-between cursor-pointer' key={link?.to}>
{link?.subMenus
? (<>

View File

@@ -104,12 +104,12 @@ const NavBar = props => {
return (
<div className="flex-shrink-0 flex">
<ul className="hidden md:flex flex-row">
{links?.map(link => <MenuItemDrop key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemDrop key={index} link={link} />)}
</ul>
<div className='md:hidden'>
<Collapse collapseRef={collapseRef} isOpen={isOpen} type='vertical' className='fixed top-16 right-6'>
<div className='dark:border-black bg-white dark:bg-black rounded border p-2 text-sm'>
{links?.map(link => <MenuItemCollapse key={link?.id} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)}/>)}
{links?.map((link, index) => <MenuItemCollapse key={index} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)}/>)}
</div>
</Collapse>
</div>

View File

@@ -54,7 +54,7 @@ const MenuList = props => {
return (
<div className="flex-shrink-0">
<ul className="hidden md:flex flex-row">
{links?.map(link => <MenuItemDrop key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemDrop key={index} link={link} />)}
<li className='my-auto px-2'>
<FullScreenButton />
</li>

View File

@@ -70,12 +70,12 @@ const NavBar = props => {
return (
<div className="flex-shrink-0">
<ul className=" hidden md:flex flex-row">
{links?.map(link => <MenuItemDrop key={link?.id} link={link} />)}
{links?.map((link, index) => <MenuItemDrop key={index} link={link} />)}
</ul>
<div className='md:hidden'><i onClick={toggleOpen} className='fas fa-bars cursor-pointer px-5 block md:hidden'></i>
<Collapse collapseRef={collapseRef} isOpen={isOpen} type='vertical' className='fixed top-16 right-6'>
<div className='dark:border-black bg-white dark:bg-black rounded border p-2 text-sm'>
{links?.map(link => <MenuItemCollapse key={link?.id} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)} />)}
{links?.map((link, index) => <MenuItemCollapse key={index} link={link} onHeightChange={(param) => collapseRef.current?.updateCollapseHeight(param)} />)}
</div>
</Collapse>
</div>