mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 23:16:51 +00:00
登录结合OpenWrite
This commit is contained in:
@@ -10,7 +10,8 @@ export default function ArticleInfo({ post }) {
|
||||
return (
|
||||
<div className='pt-10 pb-6 text-gray-400 text-sm'>
|
||||
<i className='fa-regular fa-clock mr-1' />
|
||||
Last update: {post.date?.start_date}
|
||||
Last update:{' '}
|
||||
{post.date?.start_date || post?.publishDay || post?.lastEditedDay}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import Collapse from '@/components/Collapse'
|
||||
import DarkModeButton from '@/components/DarkModeButton'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { SignInButton, SignedOut, UserButton } from '@clerk/nextjs'
|
||||
import { useRef, useState } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import LogoBar from './LogoBar'
|
||||
@@ -59,6 +60,8 @@ export default function Header(props) {
|
||||
links = customMenu
|
||||
}
|
||||
|
||||
const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
||||
|
||||
return (
|
||||
<div id='top-nav' className={'fixed top-0 w-full z-20 ' + className}>
|
||||
{/* PC端菜单 */}
|
||||
@@ -79,6 +82,19 @@ export default function Header(props) {
|
||||
|
||||
{/* 右侧 */}
|
||||
<div className='flex items-center gap-4'>
|
||||
{/* 登录相关 */}
|
||||
{enableClerk && (
|
||||
<>
|
||||
<SignedOut>
|
||||
<SignInButton mode='modal'>
|
||||
<button className='bg-green-500 hover:bg-green-600 text-white rounded-lg px-3 py-2'>
|
||||
{locale.COMMON.SIGN_IN}
|
||||
</button>
|
||||
</SignInButton>
|
||||
</SignedOut>
|
||||
<UserButton />
|
||||
</>
|
||||
)}
|
||||
<DarkModeButton className='text-sm items-center h-full hidden md:flex' />
|
||||
<SearchInput className='hidden md:flex md:w-52 lg:w-72' />
|
||||
{/* 折叠按钮、仅移动端显示 */}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
import { getShortId } from '@/lib/utils/pageId'
|
||||
import { SignIn, SignUp } from '@clerk/nextjs'
|
||||
import dynamic from 'next/dynamic'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
@@ -164,7 +165,7 @@ const LayoutBase = props => {
|
||||
{/* 中间内容区域 */}
|
||||
<div
|
||||
id='center-wrapper'
|
||||
className='dark:bg-hexo-black-gray flex flex-col justify-between w-full relative z-10 pt-14 min-h-screen'>
|
||||
className='flex flex-col justify-between w-full relative z-10 pt-14 min-h-screen'>
|
||||
<div
|
||||
id='container-inner'
|
||||
className={`w-full ${fullWidth ? 'px-5' : 'max-w-3xl px-3 lg:px-0'} justify-center mx-auto`}>
|
||||
@@ -473,6 +474,58 @@ const LayoutTagIndex = props => {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录页面
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
const LayoutSignIn = props => {
|
||||
const { post } = props
|
||||
const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='grow mt-20'>
|
||||
{/* clerk预置表单 */}
|
||||
{enableClerk && (
|
||||
<div className='flex justify-center py-6'>
|
||||
<SignIn />
|
||||
</div>
|
||||
)}
|
||||
<div id='article-wrapper'>
|
||||
<NotionPage post={post} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册页面
|
||||
* @param {*} props
|
||||
* @returns
|
||||
*/
|
||||
const LayoutSignUp = props => {
|
||||
const { post } = props
|
||||
const enableClerk = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='grow mt-20'>
|
||||
{/* clerk预置表单 */}
|
||||
{enableClerk && (
|
||||
<div className='flex justify-center py-6'>
|
||||
<SignUp />
|
||||
</div>
|
||||
)}
|
||||
<div id='article-wrapper'>
|
||||
<NotionPage post={post} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Layout404,
|
||||
LayoutArchive,
|
||||
@@ -481,6 +534,8 @@ export {
|
||||
LayoutIndex,
|
||||
LayoutPostList,
|
||||
LayoutSearch,
|
||||
LayoutSignIn,
|
||||
LayoutSignUp,
|
||||
LayoutSlug,
|
||||
LayoutTagIndex,
|
||||
CONFIG as THEME_CONFIG
|
||||
|
||||
Reference in New Issue
Block a user