feat: implement branded splash screen loading states for user and agent layouts
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { useSession } from 'next-auth/react';
|
||||
import { useRouter, usePathname } from 'next/navigation';
|
||||
import { useEffect } from 'react';
|
||||
import Image from 'next/image';
|
||||
import { Footer } from '@/components/layout/Footer';
|
||||
import { CommonHeader } from '@/components/layout/CommonHeader';
|
||||
import { PresenceProvider } from '@/components/providers/presence-provider';
|
||||
@@ -58,22 +59,29 @@ export default function UserLayout({
|
||||
}
|
||||
}, [session, status, router, pathname, isPublic]);
|
||||
|
||||
const splashLoading = (
|
||||
<div
|
||||
className="min-h-screen flex flex-col items-center justify-center"
|
||||
style={{ background: 'linear-gradient(to bottom, #c4d9d4, #f0f5fc)' }}
|
||||
>
|
||||
<Image src="/assets/images/splash-house.png" alt="" width={150} height={108} priority />
|
||||
<div className="mt-[35px]">
|
||||
<Image src="/assets/images/splash-logo.png" alt="RE-Quest" width={264} height={55} priority />
|
||||
</div>
|
||||
<div className="mt-8">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-[#00293d]" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// Show loading only for protected pages while checking auth
|
||||
if (status === 'loading' && !isPublic) {
|
||||
return (
|
||||
<div className="min-h-screen bg-white flex items-center justify-center">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-[#00293d]"></div>
|
||||
</div>
|
||||
);
|
||||
return splashLoading;
|
||||
}
|
||||
|
||||
// Redirect protected pages if not logged in
|
||||
if (!session && !isPublic) {
|
||||
return (
|
||||
<div className="min-h-screen bg-white flex items-center justify-center">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-[#00293d]"></div>
|
||||
</div>
|
||||
);
|
||||
return splashLoading;
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user