/* eslint-disable react/no-unescaped-entities */
/* eslint-disable @next/next/no-img-element */
'use client'
import Loading from '@/components/Loading'
import NotionPage from '@/components/NotionPage'
import { siteConfig } from '@/lib/config'
import { isBrowser } from '@/lib/utils'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import { About } from './components/About'
import { BackToTopButton } from './components/BackToTopButton'
import { Blog } from './components/Blog'
import { Brand } from './components/Brand'
import { Contact } from './components/Contact'
import { FAQ } from './components/FAQ'
import { Features } from './components/Features'
import { Footer } from './components/Footer'
import { Header } from './components/Header'
import { Hero } from './components/Hero'
import { Pricing } from './components/Pricing'
import { Team } from './components/Team'
import { Testimonials } from './components/Testimonials'
import CONFIG from './config'
import { Style } from './style'
// import { MadeWithButton } from './components/MadeWithButton'
import Comment from '@/components/Comment'
import replaceSearchResult from '@/components/Mark'
import ShareBar from '@/components/ShareBar'
import DashboardBody from '@/components/ui/dashboard/DashboardBody'
import DashboardHeader from '@/components/ui/dashboard/DashboardHeader'
import { useGlobal } from '@/lib/global'
import { loadWowJS } from '@/lib/plugins/wow'
import { SignIn, SignUp } from '@clerk/nextjs'
import Link from 'next/link'
import { ArticleLock } from './components/ArticleLock'
import { Banner } from './components/Banner'
import { CTA } from './components/CTA'
import SearchInput from './components/SearchInput'
import { SignInForm } from './components/SignInForm'
import { SignUpForm } from './components/SignUpForm'
import { SVG404 } from './components/svg/SVG404'
/**
* 布局框架
* Landing-2 主题用作产品落地页展示
* 结合Stripe或者lemonsqueezy插件可以成为saas支付订阅
* https://play-tailwind.tailgrids.com/
* @param {*} props
* @returns
*/
const LayoutBase = props => {
const { children } = props
// 加载wow动画
useEffect(() => {
loadWowJS()
}, [])
return (
{/* 页头 */}
{children}
{/* 页脚 */}
{/* 悬浮按钮 */}
{/*
*/}
)
}
/**
* 首页布局
* @param {*} props
* @returns
*/
const LayoutIndex = props => {
const count = siteConfig('STARTER_BLOG_COUNT', 3, CONFIG)
const { locale } = useGlobal()
const posts = props?.allNavPages ? props.allNavPages.slice(0, count) : []
return (
<>
{/* 英雄区 */}
{siteConfig('STARTER_HERO_ENABLE', true, CONFIG) && }
{/* 合作伙伴 */}
{siteConfig('STARTER_BRANDS_ENABLE', true, CONFIG) && }
{/* 产品特性 */}
{siteConfig('STARTER_FEATURE_ENABLE', true, CONFIG) && }
{/* 关于 */}
{siteConfig('STARTER_ABOUT_ENABLE', true, CONFIG) && }
{/* 价格 */}
{siteConfig('STARTER_PRICING_ENABLE', true, CONFIG) && }
{/* 评价展示 */}
{siteConfig('STARTER_TESTIMONIALS_ENABLE', true, CONFIG) && (
)}
{/* 常见问题 */}
{siteConfig('STARTER_FAQ_ENABLE', true, CONFIG) && }
{/* 团队介绍 */}
{siteConfig('STARTER_TEAM_ENABLE', true, CONFIG) && }
{/* 博文列表 */}
{siteConfig('STARTER_BLOG_ENABLE', true, CONFIG) && (
<>
{locale.COMMON.MORE}
>
)}
{/* 联系方式 */}
{siteConfig('STARTER_CONTACT_ENABLE', true, CONFIG) && }
{/* 行动呼吁 */}
{siteConfig('STARTER_CTA_ENABLE', true, CONFIG) && }
>
)
}
/**
* 文章详情页布局
* @param {*} props
* @returns
*/
const LayoutSlug = props => {
const { post, lock, validPassword } = props
// 如果 是 /article/[slug] 的文章路径则視情況进行重定向到另一个域名
const router = useRouter()
if (
!post &&
siteConfig('STARTER_POST_REDIRECT_ENABLE') &&
isBrowser &&
router.route === '/[prefix]/[slug]'
) {
const redirectUrl =
siteConfig('STARTER_POST_REDIRECT_URL') +
router.asPath.replace('?theme=landing', '')
router.push(redirectUrl)
return (
)
}
return (
<>
{lock &&
}
{!lock && post && (
)}
>
)
}
/**
* 仪表盘
* @param {*} props
* @returns
*/
const LayoutDashboard = props => {
const { post } = props
return (
<>
{/* 仪表盘 */}
>
)
}
/**
* 搜索
* @param {*} props
* @returns
*/
const LayoutSearch = props => {
const { keyword } = props
const router = useRouter()
const currentSearch = keyword || router?.query?.s
useEffect(() => {
if (isBrowser) {
replaceSearchResult({
doms: document.getElementById('posts-wrapper'),
search: keyword,
target: {
element: 'span',
className: 'text-red-500 border-b border-dashed'
}
})
}
}, [])
return (
<>
>
)
}
/**
* 文章归档
* @param {*} props
* @returns
*/
const LayoutArchive = props => (
<>
{/* 博文列表 */}
>
)
/**
* 404页面
* @param {*} props
* @returns
*/
const Layout404 = props => {
return (
<>
{/* */}
{siteConfig('STARTER_404_TITLE')}
{siteConfig('STARTER_404_TEXT')}
{siteConfig('STARTER_404_BACK')}
{/* */}
>
)
}
/**
* 翻页博客列表
*/
const LayoutPostList = props => {
const { posts, category, tag } = props
const slotTitle = category || tag
return (
<>
{/* */}
{/* 区块标题文字 */}
{slotTitle && (
{slotTitle}
)}
{!slotTitle && (
<>
{siteConfig('STARTER_BLOG_TITLE')}
{siteConfig('STARTER_BLOG_TEXT_1')}
>
)}
{/* 博客列表 此处优先展示3片文章 */}
{posts?.map((item, index) => {
return (
{item.publishDay}
{item.title}
{item.summary}
)
})}
{/* */}
>
)
}
/**
* 分类列表
* @param {*} props
* @returns
*/
const LayoutCategoryIndex = props => {
const { categoryOptions } = props
const { locale } = useGlobal()
return (
{locale.COMMON.CATEGORY}
{categoryOptions?.map(category => {
return (
{category.name}({category.count})
)
})}
)
}
/**
* 标签列表
* @param {*} props
* @returns
*/
const LayoutTagIndex = props => {
const { tagOptions } = props
const { locale } = useGlobal()
return (
)
}
/**
* 登录页面
* @param {*} props
* @returns
*/
const LayoutSignIn = props => {
const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
const title = siteConfig('STARTER_SIGNIN', '登录')
const description = siteConfig(
'STARTER_SIGNIN_DESCRITION',
'这里是演示页面,NotionNext目前不提供会员登录功能'
)
return (
<>
{/* clerk预置表单 */}
{enableClerk && (
)}
{/* 自定义登录表单 */}
{!enableClerk &&
}
>
)
}
/**
* 注册页面
* @param {*} props
* @returns
*/
const LayoutSignUp = props => {
const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
const title = siteConfig('STARTER_SIGNIN', '注册')
const description = siteConfig(
'STARTER_SIGNIN_DESCRITION',
'这里是演示页面,NotionNext目前不提供会员注册功能'
)
return (
<>
{/* clerk预置表单 */}
{enableClerk && (
)}
{/* 自定义登录表单 */}
{!enableClerk &&
}
>
)
}
export {
Layout404,
LayoutArchive,
LayoutBase,
LayoutCategoryIndex,
LayoutDashboard,
LayoutIndex,
LayoutPostList,
LayoutSearch,
LayoutSignIn,
LayoutSignUp,
LayoutSlug,
LayoutTagIndex,
CONFIG as THEME_CONFIG
}