2025-12-11 14:10:52 +08:00
|
|
|
'use client'
|
|
|
|
|
import {useProfileStore} from '@/components/stores/profile'
|
|
|
|
|
import {useRouter} from 'next/navigation'
|
|
|
|
|
import {Suspense, use} from 'react'
|
|
|
|
|
|
|
|
|
|
export default function FreeTrial(props: {
|
|
|
|
|
className: string
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
|
|
|
|
<Suspense fallback={<Pending className={props.className}/>} >
|
|
|
|
|
<Resolved className={props.className}/>
|
|
|
|
|
</Suspense>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Resolved(props: {
|
|
|
|
|
className: string
|
|
|
|
|
}) {
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const profile = use(useProfileStore(store => store.profile))
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
className={props.className}
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
router.push(profile ? '/admin/purchase' : '/product')
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-04-21 16:06:42 +08:00
|
|
|
立即试用
|
2025-12-11 14:10:52 +08:00
|
|
|
</button>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Pending(props: {
|
|
|
|
|
className: string
|
|
|
|
|
}) {
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
return (
|
|
|
|
|
<button
|
|
|
|
|
className={props.className}
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
router.push('/product')
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-04-21 16:06:42 +08:00
|
|
|
立即试用
|
2025-12-11 14:10:52 +08:00
|
|
|
</button>
|
|
|
|
|
)
|
|
|
|
|
}
|