Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: improve the user experience of not login into apps (#28120)

Joel09d31d126391
diff --git a/web/app/(commonLayout)/layout.tsx b/web/app/(commonLayout)/layout.tsx
index be9c4fe49ad..bd5b9bead26 100644
--- a/web/app/(commonLayout)/layout.tsx
+++ b/web/app/(commonLayout)/layout.tsx
@@ -10,6 +10,7 @@ import { ProviderContextProvider } from '@/context/provider-context'
import { ModalContextProvider } from '@/context/modal-context'
import GotoAnything from '@/app/components/goto-anything'
import Zendesk from '@/app/components/base/zendesk'
+import Splash from '../components/splash'
const Layout = ({ children }: { children: ReactNode }) => {
return (
@@ -25,6 +26,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
</HeaderWrapper>
{children}
<GotoAnything />
+ <Splash />
</ModalContextProvider>
</ProviderContextProvider>
</EventEmitterContextProvider>
diff --git a/web/app/components/splash.tsx b/web/app/components/splash.tsx
new file mode 100644
index 00000000000..22e3217f014
--- /dev/null
+++ b/web/app/components/splash.tsx
@@ -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)