diff --git a/themes/commerce/components/AnalyticsCard.js b/themes/commerce/components/AnalyticsCard.js
deleted file mode 100644
index 0ee1e1cd..00000000
--- a/themes/commerce/components/AnalyticsCard.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import Card from './Card'
-
-export function AnalyticsCard (props) {
- const { postCount } = props
- return
-
- 统计
-
-
-
-}
diff --git a/themes/commerce/components/Announcement.js b/themes/commerce/components/Announcement.js
deleted file mode 100644
index 695c26a4..00000000
--- a/themes/commerce/components/Announcement.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import dynamic from 'next/dynamic'
-
-const NotionPage = dynamic(() => import('@/components/NotionPage'))
-
-const Announcement = ({ post, className }) => {
- const { locale } = useGlobal()
- if (post?.blockMap) {
- return
-
- {locale.COMMON.ANNOUNCEMENT}
- {post && (
-
-
)}
-
-
- } else {
- return <>>
- }
-}
-export default Announcement
diff --git a/themes/commerce/components/ArticleAdjacent.js b/themes/commerce/components/ArticleAdjacent.js
deleted file mode 100644
index 21ca9e32..00000000
--- a/themes/commerce/components/ArticleAdjacent.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import Link from 'next/link'
-import CONFIG from '../config'
-
-/**
- * 上一篇,下一篇文章
- * @param {prev,next} param0
- * @returns
- */
-export default function ArticleAdjacent ({ prev, next }) {
- if (!prev || !next || !CONFIG.ARTICLE_ADJACENT) {
- return <>>
- }
- return (
-
-
-
- {prev.title}
-
-
-
- {next.title}
-
-
-
-
- )
-}
diff --git a/themes/commerce/components/ArticleCopyright.js b/themes/commerce/components/ArticleCopyright.js
deleted file mode 100644
index 67c65bab..00000000
--- a/themes/commerce/components/ArticleCopyright.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { useEffect, useState } from 'react'
-import CONFIG from '../config'
-import { siteConfig } from '@/lib/config'
-
-export default function ArticleCopyright () {
- const router = useRouter()
- const [path, setPath] = useState(siteConfig('LINK') + router.asPath)
- useEffect(() => {
- setPath(window.location.href)
- })
-
- const { locale } = useGlobal()
-
- if (!CONFIG.ARTICLE_COPYRIGHT) {
- return <>>
- }
-
- return (
-
-
- -
- {locale.COMMON.AUTHOR}:
-
- {siteConfig('AUTHOR')}
-
-
- -
- {locale.COMMON.URL}:
-
- {path}
-
-
- -
- {locale.COMMON.COPYRIGHT}:
- {locale.COMMON.COPYRIGHT_NOTICE}
-
-
-
- );
-}
diff --git a/themes/commerce/components/ArticleLock.js b/themes/commerce/components/ArticleLock.js
deleted file mode 100644
index 9ef687e9..00000000
--- a/themes/commerce/components/ArticleLock.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import { useEffect, useRef } from 'react'
-
-/**
- * 加密文章校验组件
- * @param {password, validPassword} props
- * @param password 正确的密码
- * @param validPassword(bool) 回调函数,校验正确回调入参为true
- * @returns
- */
-export const ArticleLock = props => {
- const { validPassword } = props
- const { locale } = useGlobal()
- const submitPassword = () => {
- const p = document.getElementById('password')
- if (!validPassword(p?.value)) {
- const tips = document.getElementById('tips')
- if (tips) {
- tips.innerHTML = ''
- tips.innerHTML = `${locale.COMMON.PASSWORD_ERROR}
`
- }
- }
- }
- const passwordInputRef = useRef(null)
- useEffect(() => {
- // 选中密码输入框并将其聚焦
- passwordInputRef.current.focus()
- }, [])
-
- return
-
-
{locale.COMMON.ARTICLE_LOCK_TIPS}
-
-
{
- if (e.key === 'Enter') {
- submitPassword()
- }
- }}
- ref={passwordInputRef} // 绑定ref到passwordInputRef变量
- className='outline-none w-full text-sm pl-5 rounded-l transition focus:shadow-lg font-light leading-10 bg-gray-100 dark:bg-gray-500'>
-
-
- {locale.COMMON.SUBMIT}
-
-
-
-
-
-
-}
diff --git a/themes/commerce/components/ArticleRecommend.js b/themes/commerce/components/ArticleRecommend.js
deleted file mode 100644
index b26aace1..00000000
--- a/themes/commerce/components/ArticleRecommend.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import Link from 'next/link'
-import CONFIG from '../config'
-import { siteConfig } from '@/lib/config'
-import { useGlobal } from '@/lib/global'
-import LazyImage from '@/components/LazyImage'
-
-/**
- * 关联推荐文章
- * @param {prev,next} param0
- * @returns
- */
-export default function ArticleRecommend({ recommendPosts, siteInfo }) {
- const { locale } = useGlobal()
-
- if (
- !CONFIG.ARTICLE_RECOMMEND ||
- !recommendPosts ||
- recommendPosts.length === 0
- ) {
- return <>>
- }
-
- return (
-
-
-
-
- {locale.COMMON.RELATE_POSTS}
-
-
-
- {recommendPosts.map(post => {
- const headerImage = post?.pageCoverThumbnail
- ? post.pageCoverThumbnail
- : siteInfo?.pageCover
-
- return (
- (
-
-
-
- )
- )
- })}
-
-
- )
-}
diff --git a/themes/commerce/components/BlogPostArchive.js b/themes/commerce/components/BlogPostArchive.js
deleted file mode 100644
index 8c3fbaaf..00000000
--- a/themes/commerce/components/BlogPostArchive.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import Link from 'next/link'
-import { siteConfig } from '@/lib/config'
-
-/**
- * 博客归档列表
- * @param posts 所有文章
- * @param archiveTitle 归档标题
- * @returns {JSX.Element}
- * @constructor
- */
-const BlogPostArchive = ({ posts = [], archiveTitle }) => {
- if (!posts || posts.length === 0) {
- return <>>
- } else {
- return (
-
- )
- }
-}
-
-export default BlogPostArchive
diff --git a/themes/commerce/components/BlogPostCardInfo.js b/themes/commerce/components/BlogPostCardInfo.js
deleted file mode 100644
index fb84cce9..00000000
--- a/themes/commerce/components/BlogPostCardInfo.js
+++ /dev/null
@@ -1,94 +0,0 @@
-import NotionPage from '@/components/NotionPage'
-import Link from 'next/link'
-import TagItemMini from './TagItemMini'
-import TwikooCommentCount from '@/components/TwikooCommentCount'
-import { siteConfig } from '@/lib/config'
-import { formatDateFmt } from '@/lib/formatDate'
-
-/**
- * 博客列表的文字内容
- * @param {*} param0
- * @returns
- */
-export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary }) => {
- return
-
- {/* 标题 */}
-
-
-
{post.title}
-
-
-
- {/* 分类 */}
- { post?.category &&
-
-
-
- {post.category}
-
-
-
-
-
}
-
- {/* 摘要 */}
- {(!showPreview || showSummary) && !post.results && (
-
- {post.summary}
-
- )}
-
- {/* 搜索结果 */}
- {post.results && (
-
- {post.results.map((r, index) => (
- {r}
- ))}
-
- )}
- {/* 预览 */}
- {showPreview && (
-
-
-
- )}
-
-
-
-
- {/* 日期标签 */}
-
- {/* 日期 */}
-
-
-
- {post?.publishDay || post.lastEditedDay}
-
-
-
-
-
- {' '}
- {post.tagItems?.map(tag => (
-
- ))}
-
-
-
-
-
-}
diff --git a/themes/commerce/components/BlogPostListEmpty.js b/themes/commerce/components/BlogPostListEmpty.js
deleted file mode 100644
index 5f75c3e7..00000000
--- a/themes/commerce/components/BlogPostListEmpty.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import { useGlobal } from '@/lib/global'
-
-/**
- * 空白博客 列表
- * @returns {JSX.Element}
- * @constructor
- */
-const BlogPostListEmpty = ({ currentSearch }) => {
- const { locale } = useGlobal()
- return
-
{locale.COMMON.NO_MORE} {(currentSearch &&
{currentSearch}
)}
-
-}
-export default BlogPostListEmpty
diff --git a/themes/commerce/components/BlogPostListPage.js b/themes/commerce/components/BlogPostListPage.js
deleted file mode 100644
index 17ca53bb..00000000
--- a/themes/commerce/components/BlogPostListPage.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import ProductCard from './ProductCard'
-import PaginationNumber from './PaginationNumber'
-import { siteConfig } from '@/lib/config'
-import BlogPostListEmpty from './BlogPostListEmpty'
-
-/**
- * 文章列表分页表格
- * @param page 当前页
- * @param posts 所有文章
- * @param tags 所有标签
- * @returns {JSX.Element}
- * @constructor
- */
-const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
- const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE')))
- const showPagination = postCount >= parseInt(siteConfig('POSTS_PER_PAGE'))
- if (!posts || posts.length === 0 || page > totalPage) {
- return
- } else {
- return (
-
- {/* 文章列表 */}
-
- {posts?.map(post => (
-
- ))}
-
- {showPagination &&
}
-
- )
- }
-}
-
-export default BlogPostListPage
diff --git a/themes/commerce/components/BlogPostListScroll.js b/themes/commerce/components/BlogPostListScroll.js
deleted file mode 100644
index 91beb929..00000000
--- a/themes/commerce/components/BlogPostListScroll.js
+++ /dev/null
@@ -1,75 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import ProductCard from './ProductCard'
-import BlogPostListEmpty from './BlogPostListEmpty'
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { getListByPage } from '@/lib/utils'
-import { useEffect, useRef, useState } from 'react'
-
-/**
- * 博客列表滚动分页
- * @param posts 所有文章
- * @param tags 所有标签
- * @returns {JSX.Element}
- * @constructor
- */
-const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
- const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
- const [page, updatePage] = useState(1)
- const postsToShow = getListByPage(posts, page, postsPerPage)
-
- let hasMore = false
- if (posts) {
- const totalCount = posts.length
- hasMore = page * postsPerPage < totalCount
- }
-
- const handleGetMore = () => {
- if (!hasMore) return
- updatePage(page + 1)
- }
-
- // 监听滚动自动分页加载
- const scrollTrigger = () => {
- requestAnimationFrame(() => {
- const scrollS = window.scrollY + window.outerHeight
- const clientHeight = targetRef ? (targetRef.current ? (targetRef.current.clientHeight) : 0) : 0
- if (scrollS > clientHeight + 100) {
- handleGetMore()
- }
- })
- }
-
- // 监听滚动
- useEffect(() => {
- window.addEventListener('scroll', scrollTrigger)
- return () => {
- window.removeEventListener('scroll', scrollTrigger)
- }
- })
-
- const targetRef = useRef(null)
- const { locale } = useGlobal()
-
- if (!postsToShow || postsToShow.length === 0) {
- return
- } else {
- return
-
- {/* 文章列表 */}
-
- {postsToShow.map(post => (
-
- ))}
-
-
-
-
{ handleGetMore() }}
- className='w-full my-4 py-4 text-center cursor-pointer rounded-xl dark:text-gray-200'
- > {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE}`}
-
-
- }
-}
-
-export default BlogPostListScroll
diff --git a/themes/commerce/components/Card.js b/themes/commerce/components/Card.js
deleted file mode 100644
index c2db0e49..00000000
--- a/themes/commerce/components/Card.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const Card = ({ children, headerSlot, className }) => {
- return
- <>{headerSlot}>
-
-
-}
-export default Card
diff --git a/themes/commerce/components/Catalog.js b/themes/commerce/components/Catalog.js
deleted file mode 100644
index 5cf1e4ad..00000000
--- a/themes/commerce/components/Catalog.js
+++ /dev/null
@@ -1,95 +0,0 @@
-import { useCallback, useEffect, useRef, useState } from 'react'
-import throttle from 'lodash.throttle'
-import { uuidToId } from 'notion-utils'
-import Progress from './Progress'
-import { useGlobal } from '@/lib/global'
-
-/**
- * 目录导航组件
- * @param toc
- * @returns {JSX.Element}
- * @constructor
- */
-const Catalog = ({ toc }) => {
- const { locale } = useGlobal()
- // 监听滚动事件
- useEffect(() => {
- window.addEventListener('scroll', actionSectionScrollSpy)
- actionSectionScrollSpy()
- return () => {
- window.removeEventListener('scroll', actionSectionScrollSpy)
- }
- }, [])
-
- // 目录自动滚动
- const tRef = useRef(null)
- const tocIds = []
-
- // 同步选中目录事件
- const [activeSection, setActiveSection] = useState(null)
-
- const throttleMs = 200
- const actionSectionScrollSpy = useCallback(throttle(() => {
- const sections = document.getElementsByClassName('notion-h')
- let prevBBox = null
- let currentSectionId = activeSection
- for (let i = 0; i < sections.length; ++i) {
- const section = sections[i]
- if (!section || !(section instanceof Element)) continue
- if (!currentSectionId) {
- currentSectionId = section.getAttribute('data-id')
- }
- const bbox = section.getBoundingClientRect()
- const prevHeight = prevBBox ? bbox.top - prevBBox.bottom : 0
- const offset = Math.max(150, prevHeight / 4)
- // GetBoundingClientRect returns values relative to viewport
- if (bbox.top - offset < 0) {
- currentSectionId = section.getAttribute('data-id')
- prevBBox = bbox
- continue
- }
- // No need to continue loop, if last element has been detected
- break
- }
- setActiveSection(currentSectionId)
- const index = tocIds.indexOf(currentSectionId) || 0
- tRef?.current?.scrollTo({ top: 28 * index, behavior: 'smooth' })
- }, throttleMs))
-
- // 无目录就直接返回空
- if (!toc || toc.length < 1) {
- return <>>
- }
-
- return
-
{locale.COMMON.TABLE_OF_CONTENTS}
-
-
-
-
-
-
-}
-
-export default Catalog
diff --git a/themes/commerce/components/CategoryGroup.js b/themes/commerce/components/CategoryGroup.js
deleted file mode 100644
index 0b313088..00000000
--- a/themes/commerce/components/CategoryGroup.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import Link from 'next/link'
-
-const CategoryGroup = ({ currentCategory, categories }) => {
- if (!categories) {
- return <>>
- }
- return <>
-
- {categories.map(category => {
- const selected = currentCategory === category.name
- return (
-
-
-
{category.name}({category.count})
-
-
- );
- })}
-
- >;
-}
-
-export default CategoryGroup
diff --git a/themes/commerce/components/FloatDarkModeButton.js b/themes/commerce/components/FloatDarkModeButton.js
deleted file mode 100644
index f693d1f0..00000000
--- a/themes/commerce/components/FloatDarkModeButton.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import { saveDarkModeToCookies } from '@/themes/theme'
-import CONFIG from '../config'
-
-export default function FloatDarkModeButton () {
- const { isDarkMode, updateDarkMode } = useGlobal()
-
- if (!CONFIG.WIDGET_DARK_MODE) {
- return <>>
- }
-
- // 用户手动设置主题
- const handleChangeDarkMode = () => {
- const newStatus = !isDarkMode
- saveDarkModeToCookies(newStatus)
- updateDarkMode(newStatus)
- const htmlElement = document.getElementsByTagName('html')[0]
- htmlElement.classList?.remove(newStatus ? 'light' : 'dark')
- htmlElement.classList?.add(newStatus ? 'dark' : 'light')
- }
-
- return (
-
-
-
- )
-}
diff --git a/themes/commerce/components/Footer.js b/themes/commerce/components/Footer.js
deleted file mode 100644
index da6a7baf..00000000
--- a/themes/commerce/components/Footer.js
+++ /dev/null
@@ -1,121 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import Link from 'next/link'
-
-/**
- * 页脚
- * @param {*} param0
- * @returns
- */
-const Footer = (props) => {
- const d = new Date()
- const currentYear = d.getFullYear()
- const since = siteConfig('SINCE')
- const copyrightDate = parseInt(since) < currentYear ? since + '-' + currentYear : currentYear
- const { categoryOptions, customMenu } = props
-
- return
-}
-
-export default Footer
diff --git a/themes/commerce/components/Hero.js b/themes/commerce/components/Hero.js
deleted file mode 100644
index af3caae1..00000000
--- a/themes/commerce/components/Hero.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// import Image from 'next/image'
-import CONFIG from '../config'
-import LazyImage from '@/components/LazyImage'
-
-/**
- * 顶部全屏大图
- * @returns
- */
-const Hero = props => {
- const { siteInfo } = props
-
- return (
-
- )
-}
-
-export default Hero
diff --git a/themes/commerce/components/HexoRecentComments.js b/themes/commerce/components/HexoRecentComments.js
deleted file mode 100644
index db712bea..00000000
--- a/themes/commerce/components/HexoRecentComments.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import { useEffect, useState } from 'react'
-import { siteConfig } from '@/lib/config'
-import Card from '@/themes/hexo/components/Card'
-import { useGlobal } from '@/lib/global'
-import Link from 'next/link'
-import { RecentComments } from '@waline/client'
-
-/**
- * @see https://waline.js.org/guide/get-started.html
- * @param {*} props
- * @returns
- */
-const HexoRecentComments = (props) => {
- const [comments, updateComments] = useState([])
- const { locale } = useGlobal()
- const [onLoading, changeLoading] = useState(true)
- useEffect(() => {
- RecentComments({
- serverURL: siteConfig('COMMENT_WALINE_SERVER_URL'),
- count: 5
- }).then(({ comments }) => {
- changeLoading(false)
- updateComments(comments)
- })
- }, [])
-
- return (
-
-
-
- {locale.COMMON.RECENT_COMMENTS}
-
-
- {onLoading && Loading...
}
- {!onLoading && comments && comments.length === 0 && No Comments
}
- {!onLoading && comments && comments.length > 0 && comments.map((comment) =>
-
-
- --{comment.nick}
-
-
)}
-
-
- )
-}
-
-export default HexoRecentComments
diff --git a/themes/commerce/components/InfoCard.js b/themes/commerce/components/InfoCard.js
deleted file mode 100644
index 6b33034e..00000000
--- a/themes/commerce/components/InfoCard.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { useRouter } from 'next/router'
-import Card from './Card'
-import SocialButton from './SocialButton'
-import MenuGroupCard from './MenuGroupCard'
-import LazyImage from '@/components/LazyImage'
-import { siteConfig } from '@/lib/config'
-
-/**
- * 社交信息卡
- * @param {*} props
- * @returns
- */
-export function InfoCard(props) {
- const { className, siteInfo } = props
- const router = useRouter()
- return (
-
- {
- router.push('/')
- }}
- >
- {/* eslint-disable-next-line @next/next/no-img-element */}
-
-
- {siteConfig('AUTHOR')}
- {siteConfig('BIO')}
-
-
-
- )
-}
diff --git a/themes/commerce/components/JumpToCommentButton.js b/themes/commerce/components/JumpToCommentButton.js
deleted file mode 100644
index ded36c9a..00000000
--- a/themes/commerce/components/JumpToCommentButton.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import CONFIG from '../config'
-
-/**
- * 跳转到评论区
- * @returns {JSX.Element}
- * @constructor
- */
-const JumpToCommentButton = () => {
- if (!CONFIG.WIDGET_TO_COMMENT) {
- return <>>
- }
-
- function navToComment() {
- if (document.getElementById('comment')) {
- window.scrollTo({ top: document.getElementById('comment').offsetTop, behavior: 'smooth' })
- }
- // 兼容性不好
- // const commentElement = document.getElementById('comment')
- // if (commentElement) {
- // commentElement?.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'nearest' })
- }
-
- return (
-
-
)
-}
-
-export default JumpToCommentButton
diff --git a/themes/commerce/components/JumpToTopButton.js b/themes/commerce/components/JumpToTopButton.js
deleted file mode 100644
index a89899a9..00000000
--- a/themes/commerce/components/JumpToTopButton.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-
-/**
- * 跳转到网页顶部
- * 当屏幕下滑500像素后会出现该控件
- * @param targetRef 关联高度的目标html标签
- * @param showPercent 是否显示百分比
- * @returns {JSX.Element}
- * @constructor
- */
-const JumpToTopButton = ({ showPercent = true, percent }) => {
- const { locale } = useGlobal()
-
- if (!CONFIG.WIDGET_TO_TOP) {
- return <>>
- }
- return ( window.scrollTo({ top: 0, behavior: 'smooth' })} >
-
- {showPercent && (
{percent}
)}
-
)
-}
-
-export default JumpToTopButton
diff --git a/themes/commerce/components/LatestPostsGroup.js b/themes/commerce/components/LatestPostsGroup.js
deleted file mode 100644
index 3c4fadbc..00000000
--- a/themes/commerce/components/LatestPostsGroup.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import LazyImage from '@/components/LazyImage'
-import { useGlobal } from '@/lib/global'
-// import Image from 'next/image'
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-
-/**
- * 最新文章列表
- * @param posts 所有文章数据
- * @param sliceCount 截取展示的数量 默认6
- * @constructor
- */
-const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
- // 获取当前路径
- const currentPath = useRouter().asPath
- const { locale } = useGlobal()
-
- if (!latestPosts) {
- return <>>
- }
-
- return <>
-
-
-
- {locale.COMMON.LATEST_POSTS}
-
-
- {latestPosts.map(post => {
- const selected = currentPath === `${siteConfig('SUB_PATH', '')}/${post.slug}`
-
- const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover
-
- return (
- (
-
-
-
-
-
-
-
{post.title}
-
{post.lastEditedDay}
-
-
-
- )
- )
- })}
- >
-}
-export default LatestPostsGroup
diff --git a/themes/commerce/components/LoadingCover.js b/themes/commerce/components/LoadingCover.js
deleted file mode 100644
index c6418fad..00000000
--- a/themes/commerce/components/LoadingCover.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default function LoadingCover () {
- return (
- )
-}
diff --git a/themes/commerce/components/LogoBar.js b/themes/commerce/components/LogoBar.js
deleted file mode 100644
index de5a5bfe..00000000
--- a/themes/commerce/components/LogoBar.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import Link from 'next/link'
-// import { siteConfig } from '@/lib/config'
-import LazyImage from '@/components/LazyImage';
-
-/**
- * Logo图标
- * @param {*} props
- * @returns
- */
-export default function LogoBar (props) {
- const { siteInfo } = props
- return (
-
-
-
-
- {/* {siteConfig('TITLE')}
*/}
-
- );
-}
diff --git a/themes/commerce/components/MenuBarMobile.js b/themes/commerce/components/MenuBarMobile.js
deleted file mode 100644
index a8ba0f12..00000000
--- a/themes/commerce/components/MenuBarMobile.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { MenuItemCollapse } from './MenuItemCollapse'
-import { siteConfig } from '@/lib/config'
-
-export const MenuBarMobile = (props) => {
- const { customMenu, customNav } = props
- const { locale } = useGlobal()
-
- let links = [
- // { name: locale.NAV.INDEX, to: '/' || '/', show: true },
- { name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
- { name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG },
- { name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE }
- // { name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH }
- ]
-
- if (customNav) {
- links = links.concat(customNav)
- }
-
- // 如果 开启自定义菜单,则不再使用 Page生成菜单。
- if (siteConfig('CUSTOM_MENU')) {
- links = customMenu
- }
-
- if (!links || links.length === 0) {
- return null
- }
-
- return (
-
- )
-}
diff --git a/themes/commerce/components/MenuGroupCard.js b/themes/commerce/components/MenuGroupCard.js
deleted file mode 100644
index 5e4d84a4..00000000
--- a/themes/commerce/components/MenuGroupCard.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import Link from 'next/link'
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-
-const MenuGroupCard = (props) => {
- const { postCount, categoryOptions, tagOptions } = props
- const { locale } = useGlobal()
- const archiveSlot = {postCount}
- const categorySlot = {categoryOptions?.length}
- const tagSlot = {tagOptions?.length}
-
- const links = [
- { name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: CONFIG.MENU_ARCHIVE },
- { name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: CONFIG.MENU_CATEGORY },
- { name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG.MENU_TAG }
- ]
-
- for (let i = 0; i < links.length; i++) {
- if (links[i].id !== i) {
- links[i].id = i
- }
- }
-
- return (
-
- )
-}
-export default MenuGroupCard
diff --git a/themes/commerce/components/MenuItemCollapse.js b/themes/commerce/components/MenuItemCollapse.js
deleted file mode 100644
index 1ce6d59d..00000000
--- a/themes/commerce/components/MenuItemCollapse.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import Collapse from '@/components/Collapse'
-import Link from 'next/link'
-import { useState } from 'react'
-
-/**
- * 折叠菜单
- * @param {*} param0
- * @returns
- */
-export const MenuItemCollapse = (props) => {
- const { link } = props
- const [show, changeShow] = useState(false)
- const hasSubMenu = link?.subMenus?.length > 0
-
- const [isOpen, changeIsOpen] = useState(false)
-
- const toggleShow = () => {
- changeShow(!show)
- }
-
- const toggleOpenSubMenu = () => {
- changeIsOpen(!isOpen)
- }
-
- if (!link || !link.show) {
- return null
- }
-
- return <>
-
- {!hasSubMenu &&
-
{link?.icon && }{link?.name}
- }
- {hasSubMenu &&
- {link?.icon && }{link?.name}
-
-
}
-
-
- {/* 折叠子菜单 */}
- {hasSubMenu &&
- {link.subMenus.map((sLink, index) => {
- return
-
- {link?.icon && } {sLink.title}
-
-
- })}
- }
- >
-}
diff --git a/themes/commerce/components/MenuItemDrop.js b/themes/commerce/components/MenuItemDrop.js
deleted file mode 100644
index e83f46f7..00000000
--- a/themes/commerce/components/MenuItemDrop.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { useState } from 'react'
-
-export const MenuItemDrop = ({ link }) => {
- const [show, changeShow] = useState(false)
- const hasSubMenu = link?.subMenus?.length > 0
- const selected = useRouter().asPath === link?.to
-
- if (!link || !link.show) {
- return null
- }
-
- return changeShow(true)} onMouseOut={() => changeShow(false)} className='h-full'>
-
- {!hasSubMenu &&
-
- {link?.icon &&
} {link?.name}
- {/* {hasSubMenu && } */}
- }
-
- {hasSubMenu && <>
-
- {link?.icon &&
} {link?.name}
- {/* */}
-
- >}
-
- {/* 子菜单 */}
- {hasSubMenu &&
- {link.subMenus.map((sLink, index) => {
- return -
-
- {link?.icon && }{sLink.title}
-
-
- })}
-
}
-
-
-}
diff --git a/themes/commerce/components/MenuListSide.js b/themes/commerce/components/MenuListSide.js
deleted file mode 100644
index 89133256..00000000
--- a/themes/commerce/components/MenuListSide.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import { siteConfig } from '@/lib/config'
-import { MenuItemCollapse } from './MenuItemCollapse'
-import CONFIG from '../config'
-
-export const MenuListSide = (props) => {
- const { customNav, customMenu } = props
- const { locale } = useGlobal()
-
- let links = [
- { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
- { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
- { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
- { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG }
- ]
-
- if (customNav) {
- links = customNav.concat(links)
- }
-
- for (let i = 0; i < links.length; i++) {
- if (links[i].id !== i) {
- links[i].id = i
- }
- }
-
- // 如果 开启自定义菜单,则覆盖Page生成的菜单
- if (siteConfig('CUSTOM_MENU')) {
- links = customMenu
- }
-
- if (!links || links.length === 0) {
- return null
- }
-
- return (
-
- )
-}
diff --git a/themes/commerce/components/MenuListTop.js b/themes/commerce/components/MenuListTop.js
deleted file mode 100644
index c4a10085..00000000
--- a/themes/commerce/components/MenuListTop.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import CONFIG from '../config'
-import { MenuItemDrop } from './MenuItemDrop'
-import { siteConfig } from '@/lib/config'
-
-export const MenuListTop = (props) => {
- const { customNav, customMenu } = props
- const { locale } = useGlobal()
-
- let links = [
- { id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: CONFIG.MENU_INDEX },
- { id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
- { id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE }
- // { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
- // { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG }
- ]
-
- if (customNav) {
- links = links.concat(customNav)
- }
-
- for (let i = 0; i < links.length; i++) {
- if (links[i].id !== i) {
- links[i].id = i
- }
- }
-
- // 如果 开启自定义菜单,则覆盖Page生成的菜单
- if (siteConfig('CUSTOM_MENU')) {
- links = customMenu
- }
-
- if (!links || links.length === 0) {
- return null
- }
-
- return (<>
-
- >)
-}
diff --git a/themes/commerce/components/NavButtonGroup.js b/themes/commerce/components/NavButtonGroup.js
deleted file mode 100644
index 8539eb49..00000000
--- a/themes/commerce/components/NavButtonGroup.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import Link from 'next/link'
-
-/**
- * 首页导航大按钮组件
- * @param {*} props
- * @returns
- */
-const NavButtonGroup = (props) => {
- const { categoryOptions } = props
- if (!categoryOptions || categoryOptions.length === 0) {
- return <>>
- }
-
- return (
-
- )
-}
-export default NavButtonGroup
diff --git a/themes/commerce/components/PaginationNumber.js b/themes/commerce/components/PaginationNumber.js
deleted file mode 100644
index d041fe6c..00000000
--- a/themes/commerce/components/PaginationNumber.js
+++ /dev/null
@@ -1,107 +0,0 @@
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-
-/**
- * 数字翻页插件
- * @param page 当前页码
- * @param showNext 是否有下一页
- * @returns {JSX.Element}
- * @constructor
- */
-const PaginationNumber = ({ page, totalPage }) => {
- const router = useRouter()
- const currentPage = +page
- const showNext = page < totalPage
- const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
- const pages = generatePages(pagePrefix, page, currentPage, totalPage)
-
- return (
-
- {/* 上一页 */}
-
-
-
-
-
-
- {pages}
-
- {/* 下一页 */}
-
-
-
-
-
-
- )
-}
-
-function getPageElement(page, currentPage, pagePrefix) {
- return (
- (
-
- {page}
-
- )
- )
-}
-
-function generatePages(pagePrefix, page, currentPage, totalPage) {
- const pages = []
- const groupCount = 7 // 最多显示页签数
- if (totalPage <= groupCount) {
- for (let i = 1; i <= totalPage; i++) {
- pages.push(getPageElement(i, page, pagePrefix))
- }
- } else {
- pages.push(getPageElement(1, page, pagePrefix))
- const dynamicGroupCount = groupCount - 2
- let startPage = currentPage - 2
- if (startPage <= 1) {
- startPage = 2
- }
- if (startPage + dynamicGroupCount > totalPage) {
- startPage = totalPage - dynamicGroupCount
- }
- if (startPage > 2) {
- pages.push(...
)
- }
-
- for (let i = 0; i < dynamicGroupCount; i++) {
- if (startPage + i < totalPage) {
- pages.push(getPageElement(startPage + i, page, pagePrefix))
- }
- }
-
- if (startPage + dynamicGroupCount < totalPage) {
- pages.push(...
)
- }
-
- pages.push(getPageElement(totalPage, page, pagePrefix))
- }
- return pages
-}
-export default PaginationNumber
diff --git a/themes/commerce/components/PostHeader.js b/themes/commerce/components/PostHeader.js
deleted file mode 100644
index e73314f1..00000000
--- a/themes/commerce/components/PostHeader.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import Link from 'next/link'
-import NotionIcon from '@/components/NotionIcon'
-import LazyImage from '@/components/LazyImage'
-
-export default function PostHeader({ post, siteInfo }) {
- if (!post) {
- return <>>
- }
- const headerImage = post?.pageCover ? post.pageCover : siteInfo?.pageCover
- const title = post?.title
- return (
-
- )
-}
diff --git a/themes/commerce/components/ProductCard.js b/themes/commerce/components/ProductCard.js
deleted file mode 100644
index 8ec25b6c..00000000
--- a/themes/commerce/components/ProductCard.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import Link from 'next/link'
-import CONFIG from '../config'
-import { siteConfig } from '@/lib/config'
-import LazyImage from '@/components/LazyImage'
-// import Image from 'next/image'
-
-/**
- * 商品卡
- */
-const ProductCard = ({ index, post, siteInfo }) => {
- if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
- post.pageCoverThumbnail = siteInfo?.pageCover
- }
-
- return (
-
-
-
-
-
- {/* 图片封面 */}
-
-
-
-
-
-
-
{post.title}
-
-
-
-
-
- )
-}
-
-export default ProductCard
diff --git a/themes/commerce/components/ProductCategories.js b/themes/commerce/components/ProductCategories.js
deleted file mode 100644
index 22ec36b9..00000000
--- a/themes/commerce/components/ProductCategories.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import Link from 'next/link'
-
-export default function ProductCategories(props) {
- const { categoryOptions } = props
-
- return
- {/* 分类菜单 */}
-
-
{siteConfig('COMMERCE_TEXT_MENU_GROUP', 'Product Categories')}
-
-
-
-}
diff --git a/themes/commerce/components/ProductCenter.js b/themes/commerce/components/ProductCenter.js
deleted file mode 100644
index ec82469d..00000000
--- a/themes/commerce/components/ProductCenter.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import ProductCard from './ProductCard'
-import ProductCategories from './ProductCategories'
-
-/**
- * 产品中心
- * @param {*} props
- * @returns
- */
-export default function ProductCenter(props) {
- const { allNavPages } = props
- const posts = allNavPages.slice(0, parseInt(siteConfig('COMMERCE_HOME_POSTS_COUNT', 9)))
-
- return
-
{siteConfig('COMMERCE_TEXT_CENTER_TITLE', 'Product Center')}
- {siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION') &&
{siteConfig('COMMERCE_TEXT_CENTER_DESCRIPTION')}
}
-
-
-
-
-
-
- {/* 文章列表 */}
-
- {posts?.map(post => (
-
- ))}
-
-
-
-
-
-}
diff --git a/themes/commerce/components/Progress.js b/themes/commerce/components/Progress.js
deleted file mode 100644
index 585e1c21..00000000
--- a/themes/commerce/components/Progress.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import { useEffect, useState } from 'react'
-import { isBrowser } from '@/lib/utils'
-
-/**
- * 顶部页面阅读进度条
- * @returns {JSX.Element}
- * @constructor
- */
-const Progress = ({ targetRef, showPercent = true }) => {
- const currentRef = targetRef?.current || targetRef
- const [percent, changePercent] = useState(0)
- const scrollListener = () => {
- const target = currentRef || (isBrowser && document.getElementById('article-wrapper'))
- if (target) {
- const clientHeight = target.clientHeight
- const scrollY = window.pageYOffset
- const fullHeight = clientHeight - window.outerHeight
- let per = parseFloat(((scrollY / fullHeight) * 100).toFixed(0))
- if (per > 100) per = 100
- if (per < 0) per = 0
- changePercent(per)
- }
- }
-
- useEffect(() => {
- document.addEventListener('scroll', scrollListener)
- return () => document.removeEventListener('scroll', scrollListener)
- }, [])
-
- return (
-
-
- {showPercent && (
-
{percent}%
- )}
-
-
- )
-}
-
-export default Progress
diff --git a/themes/commerce/components/RightFloatArea.js b/themes/commerce/components/RightFloatArea.js
deleted file mode 100644
index 0d5015a1..00000000
--- a/themes/commerce/components/RightFloatArea.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import throttle from 'lodash.throttle'
-import { useCallback, useEffect, useState } from 'react'
-import JumpToTopButton from './JumpToTopButton'
-
-/**
- * 悬浮在右下角的按钮,当页面向下滚动100px时会出现
- * @param {*} param0
- * @returns
- */
-export default function RightFloatArea({ floatSlot }) {
- const [showFloatButton, switchShow] = useState(false)
- const scrollListener = useCallback(throttle(() => {
- const targetRef = document.getElementById('wrapper')
- const clientHeight = targetRef?.clientHeight
- const scrollY = window.pageYOffset
- const fullHeight = clientHeight - window.outerHeight
- let per = parseFloat(((scrollY / fullHeight) * 100).toFixed(0))
- if (per > 100) per = 100
- const shouldShow = scrollY > 100 && per > 0
-
- // 右下角显示悬浮按钮
- if (shouldShow !== showFloatButton) {
- switchShow(shouldShow)
- }
- }, 200))
-
- useEffect(() => {
- document.addEventListener('scroll', scrollListener)
- return () => document.removeEventListener('scroll', scrollListener)
- }, [])
-
- return (
-
-
- {/* */}
- {floatSlot}
-
-
-
- )
-}
diff --git a/themes/commerce/components/SearchDrawer.js b/themes/commerce/components/SearchDrawer.js
deleted file mode 100644
index c7ec88a7..00000000
--- a/themes/commerce/components/SearchDrawer.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import { Router } from 'next/router'
-import { useImperativeHandle, useRef } from 'react'
-import SearchInput from './SearchInput'
-const SearchDrawer = ({ cRef, slot }) => {
- const searchDrawer = useRef()
- const searchInputRef = useRef()
- useImperativeHandle(cRef, () => {
- return {
- show: () => {
- searchDrawer?.current?.classList?.remove('hidden')
- searchInputRef?.current?.focus()
- }
- }
- })
- const hidden = () => {
- searchDrawer?.current?.classList?.add('hidden')
- }
- Router.events.on('routeChangeComplete', (...args) => {
- hidden()
- })
- return (
-
- )
-}
-
-export default SearchDrawer
diff --git a/themes/commerce/components/SearchInput.js b/themes/commerce/components/SearchInput.js
deleted file mode 100644
index 462c58b3..00000000
--- a/themes/commerce/components/SearchInput.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import { useRouter } from 'next/router'
-import { useImperativeHandle, useRef, useState } from 'react'
-import { useGlobal } from '@/lib/global'
-let lock = false
-
-const SearchInput = props => {
- const { currentSearch, cRef, className } = props
- const [onLoading, setLoadingState] = useState(false)
- const router = useRouter()
- const searchInputRef = useRef()
- const { locale } = useGlobal()
- useImperativeHandle(cRef, () => {
- return {
- focus: () => {
- searchInputRef?.current?.focus()
- }
- }
- })
-
- const handleSearch = () => {
- const key = searchInputRef.current.value
- if (key && key !== '') {
- setLoadingState(true)
- router.push({ pathname: '/search/' + key }).then(r => {
- setLoadingState(false)
- })
- // location.href = '/search/' + key
- } else {
- router.push({ pathname: '/' }).then(r => {})
- }
- }
- const handleKeyUp = e => {
- if (e.keyCode === 13) {
- // 回车
- handleSearch(searchInputRef.current.value)
- } else if (e.keyCode === 27) {
- // ESC
- cleanSearch()
- }
- }
- const cleanSearch = () => {
- searchInputRef.current.value = ''
- }
-
- const [showClean, setShowClean] = useState(false)
- const updateSearchKey = val => {
- if (lock) {
- return
- }
- searchInputRef.current.value = val
-
- if (val) {
- setShowClean(true)
- } else {
- setShowClean(false)
- }
- }
- function lockSearchInput () {
- lock = true
- }
-
- function unLockSearchInput () {
- lock = false
- }
-
- return (
-
-
updateSearchKey(e.target.value)}
- defaultValue={currentSearch || ''}
- />
-
-
-
-
-
- {showClean && (
-
-
-
- )}
-
- )
-}
-
-export default SearchInput
diff --git a/themes/commerce/components/SearchNav.js b/themes/commerce/components/SearchNav.js
deleted file mode 100644
index fc393c1b..00000000
--- a/themes/commerce/components/SearchNav.js
+++ /dev/null
@@ -1,70 +0,0 @@
-import { useGlobal } from '@/lib/global'
-import Link from 'next/link'
-import { useEffect, useRef } from 'react'
-import Card from './Card'
-import SearchInput from './SearchInput'
-import TagItemMini from './TagItemMini'
-
-/**
- * 搜索页面的导航
- * @param {*} props
- * @returns
- */
-export default function SearchNav(props) {
- const { tagOptions, categoryOptions } = props
- const cRef = useRef(null)
- const { locale } = useGlobal()
- useEffect(() => {
- // 自动聚焦到搜索框
- cRef?.current?.focus()
- }, [])
-
- return <>
-
-
- {/* 分类 */}
-
-
-
- {locale.COMMON.CATEGORY}:
-
-
- {categoryOptions?.map(category => {
- return (
-
-
-
- {category.name}({category.count})
-
-
- )
- })}
-
-
- {/* 标签 */}
-
-
-
- {locale.COMMON.TAGS}:
-
-
-
-
->
-}
diff --git a/themes/commerce/components/SideBar.js b/themes/commerce/components/SideBar.js
deleted file mode 100644
index 913ce0a9..00000000
--- a/themes/commerce/components/SideBar.js
+++ /dev/null
@@ -1,33 +0,0 @@
-import { siteConfig } from '@/lib/config'
-import LazyImage from '@/components/LazyImage'
-import { useRouter } from 'next/router'
-import MenuGroupCard from './MenuGroupCard'
-import { MenuListSide } from './MenuListSide'
-
-/**
- * 侧边抽屉
- * @param tags
- * @param currentTag
- * @returns {JSX.Element}
- * @constructor
- */
-const SideBar = (props) => {
- const { siteInfo } = props
- const router = useRouter()
- return (
-
-
-
-
{ router.push('/') }}
- className='justify-center items-center flex hover:rotate-45 py-6 hover:scale-105 dark:text-gray-100 transform duration-200 cursor-pointer'>
-
-
-
-
-
-
-
- )
-}
-
-export default SideBar
diff --git a/themes/commerce/components/SideBarDrawer.js b/themes/commerce/components/SideBarDrawer.js
deleted file mode 100644
index f457d4a3..00000000
--- a/themes/commerce/components/SideBarDrawer.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import { useRouter } from 'next/router'
-import { useEffect } from 'react'
-
-/**
- * 侧边栏抽屉面板,可以从侧面拉出
- * @returns {JSX.Element}
- * @constructor
- */
-const SideBarDrawer = ({ children, isOpen, onOpen, onClose, className }) => {
- const router = useRouter()
- useEffect(() => {
- const sideBarDrawerRouteListener = () => {
- switchSideDrawerVisible(false)
- }
- router.events.on('routeChangeComplete', sideBarDrawerRouteListener)
- return () => {
- router.events.off('routeChangeComplete', sideBarDrawerRouteListener)
- }
- }, [router.events])
-
- // 点击按钮更改侧边抽屉状态
- const switchSideDrawerVisible = (showStatus) => {
- if (showStatus) {
- onOpen && onOpen()
- } else {
- onClose && onClose()
- }
- const sideBarDrawer = window.document.getElementById('sidebar-drawer')
- const sideBarDrawerBackground = window.document.getElementById('sidebar-drawer-background')
-
- if (showStatus) {
- sideBarDrawer?.classList.replace('-mr-72', 'mr-0')
- sideBarDrawerBackground?.classList.replace('hidden', 'block')
- } else {
- sideBarDrawer?.classList.replace('mr-0', '-mr-72')
- sideBarDrawerBackground?.classList.replace('block', 'hidden')
- }
- }
-
- return