mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore: improve the user experience of not login into apps (#28120)
This commit is contained in:
@ -11,6 +11,7 @@ import { ProviderContextProvider } from '@/context/provider-context'
|
|||||||
import { ModalContextProvider } from '@/context/modal-context'
|
import { ModalContextProvider } from '@/context/modal-context'
|
||||||
import GotoAnything from '@/app/components/goto-anything'
|
import GotoAnything from '@/app/components/goto-anything'
|
||||||
import Zendesk from '@/app/components/base/zendesk'
|
import Zendesk from '@/app/components/base/zendesk'
|
||||||
|
import Splash from '../components/splash'
|
||||||
|
|
||||||
const Layout = ({ children }: { children: ReactNode }) => {
|
const Layout = ({ children }: { children: ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
@ -27,6 +28,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||||||
</HeaderWrapper>
|
</HeaderWrapper>
|
||||||
{children}
|
{children}
|
||||||
<GotoAnything />
|
<GotoAnything />
|
||||||
|
<Splash />
|
||||||
</ModalContextProvider>
|
</ModalContextProvider>
|
||||||
</ProviderContextProvider>
|
</ProviderContextProvider>
|
||||||
</EventEmitterContextProvider>
|
</EventEmitterContextProvider>
|
||||||
|
|||||||
21
web/app/components/splash.tsx
Normal file
21
web/app/components/splash.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC, PropsWithChildren } from 'react'
|
||||||
|
import React from 'react'
|
||||||
|
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 (
|
||||||
|
<div className='fixed inset-0 z-[9999999] flex h-full items-center justify-center bg-background-body'>
|
||||||
|
<Loading />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
export default React.memo(Splash)
|
||||||
Reference in New Issue
Block a user