2025-03-28 15:00:46 +08:00
|
|
|
import Link from 'next/link'
|
|
|
|
|
import {cookies} from 'next/headers'
|
|
|
|
|
import {Button} from '@/components/ui/button'
|
|
|
|
|
import {AuthContext} from '@/lib/auth'
|
|
|
|
|
|
|
|
|
|
export type UserCenterProps = {}
|
|
|
|
|
|
|
|
|
|
export default async function UserCenter(props: UserCenterProps) {
|
|
|
|
|
|
|
|
|
|
const store = await cookies()
|
|
|
|
|
const info = store.get('auth_info')?.value
|
|
|
|
|
const data = info ? JSON.parse(info) as AuthContext : undefined
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`flex items-center`}>
|
|
|
|
|
{data == undefined
|
|
|
|
|
? <>
|
|
|
|
|
<Link
|
|
|
|
|
href="/login"
|
|
|
|
|
className={`w-24 h-12 flex items-center justify-center lg:text-lg`}
|
|
|
|
|
>
|
|
|
|
|
<span>登录</span>
|
|
|
|
|
</Link>
|
|
|
|
|
<Link
|
|
|
|
|
href="/login"
|
|
|
|
|
className={[
|
|
|
|
|
`w-20 lg:w-24 h-10 lg:h-12 bg-gradient-to-r rounded-sm flex items-center justify-center lg:text-lg text-white`,
|
|
|
|
|
`transition-colors duration-200 ease-in-out`,
|
|
|
|
|
`from-blue-500 to-cyan-400 hover:from-blue-500 hover:to-cyan-300`,
|
|
|
|
|
].join(' ')}
|
|
|
|
|
>
|
|
|
|
|
<span>注册</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</>
|
2025-04-18 17:48:12 +08:00
|
|
|
: (
|
2025-04-08 11:21:58 +08:00
|
|
|
<Link href={`/admin`}>
|
2025-04-12 11:10:51 +08:00
|
|
|
<Button theme={`gradient`}>
|
2025-04-07 15:42:09 +08:00
|
|
|
进入控制台
|
|
|
|
|
</Button>
|
|
|
|
|
</Link>
|
2025-04-18 17:48:12 +08:00
|
|
|
)
|
2025-03-28 15:00:46 +08:00
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|