2025-11-12 08:47:45 +00:00
|
|
|
'use client'
|
|
|
|
|
import type { FC, PropsWithChildren } from 'react'
|
2025-12-23 10:02:10 +00:00
|
|
|
import * as React from 'react'
|
2025-11-12 08:47:45 +00:00
|
|
|
import { useIsLogin } from '@/service/use-common'
|
|
|
|
|
import Loading from './base/loading'
|
|
|
|
|
|
|
|
|
|
const Splash: FC<PropsWithChildren> = () => {
|
|
|
|
|
// would auto redirect to signin page if not logged in
|
|
|
|
|
const { isLoading, data: loginData } = useIsLogin()
|
|
|
|
|
const isLoggedIn = loginData?.logged_in
|
|
|
|
|
|
|
|
|
|
if (isLoading || !isLoggedIn) {
|
|
|
|
|
return (
|
2025-12-23 08:58:55 +00:00
|
|
|
<div className="fixed inset-0 z-[9999999] flex h-full items-center justify-center bg-background-body">
|
2025-11-12 08:47:45 +00:00
|
|
|
<Loading />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
export default React.memo(Splash)
|