diff --git a/sites/mainweb/app/(portal)/login/page.tsx b/sites/mainweb/app/(portal)/login/page.tsx index 5093b7e..41cc92e 100644 --- a/sites/mainweb/app/(portal)/login/page.tsx +++ b/sites/mainweb/app/(portal)/login/page.tsx @@ -10,118 +10,199 @@ export default function Home() { const router = useRouter(); const [mounted, setMounted] = useState(false); + const [logs, setLogs] = useState([ + "Initializing terminal...", + "System check: OK", + "Loading background modules..." + ]); + const { data: adminStatus } = trpc.admin.isAdmin.useQuery(undefined, { enabled: !!session, }); + const { data: memberStatus } = trpc.member.checkStatus.useQuery(undefined, { + enabled: !!session, + }); + const { data: judgeStatus } = trpc.judge.isJudge.useQuery(undefined, { enabled: !!session, }); + const { mutate: sayHello, isPending: helloLoading } = + trpc.hello.sayHello.useMutation({ + onSuccess: (res) => { + setLogs(prev => [...prev.slice(-4), `> Response: ${res.message}`]); + }, + onError: () => { + setLogs(prev => [...prev.slice(-4), "> Error: Connection failed"]); + } + }); + useEffect(() => { setMounted(true); + + const timeout = setTimeout(() => { + setLogs(prev => [...prev.slice(-4), "> Network: Established", "> Session: Awaiting user..."]); + }, 800); + + return () => clearTimeout(timeout); }, []); + useEffect(() => { + if (adminStatus) { + const roleLog = adminStatus.isAdmin + ? `> Admin Access: ${adminStatus.role?.toUpperCase()}` + : "> Access Level: Standard User"; + setLogs(prev => [...prev.slice(-4), roleLog]); + } + }, [adminStatus]); + + useEffect(() => { + if (memberStatus) { + const memberLog = memberStatus.isMember + ? `> Membership: ${memberStatus.memberType?.toUpperCase()} (${memberStatus.daysRemaining} days remaining)` + : "> Membership: Not Active"; + setLogs(prev => [...prev.slice(-4), memberLog]); + } + }, [memberStatus]); + + useEffect(() => { + if (judgeStatus?.isJudge) { + setLogs(prev => [...prev.slice(-4), "> Role Detected: JUDGE"]); + } + }, [judgeStatus]); + useEffect(() => { if (status === 'authenticated' && session) { + setLogs(prev => [...prev.slice(-4), "> Auth success. Handshaking...", "> Redirecting to secure node..."]); + const redirectTimeout = setTimeout(() => { if (judgeStatus?.isJudge && !adminStatus?.isAdmin) { router.push('/judge'); } else { router.push('/dashboard'); } - }, 800); + }, 1200); + return () => clearTimeout(redirectTimeout); } }, [status, session, router, judgeStatus, adminStatus]); + const handleTestEndpoint = () => { + setLogs(prev => [...prev.slice(-4), "> Executing: public.sayHello()"]); + sayHello(); + }; + const handleSignIn = () => { + setLogs(prev => [...prev.slice(-4), "> Initializing OAuth..."]); signIn('google', { callbackUrl: '/dashboard' }); }; - if (!mounted) return
; + if (!mounted) return
; const isRedirecting = status === 'authenticated'; - const isLoading = status === 'loading'; return ( -
- {/* Background */} +
+
-
-
+
+
-
- {/* Logo */} -
-
-
- DSGT Logo +
+ +
+
+
+
+ Query Engine // V.1 +
+ +

+ Query
+ + DSGT. + +

+ +
+

+ The collective intelligence of Georgia Tech's largest data science community. Authenticate to access your dashboard. +

+ +
+
+ {logs.map((log, i) => ( +

+ {log} +

+ ))} + {(helloLoading || isRedirecting || status === 'loading') && ( +

+ {'>'} {status === 'loading' ? 'Syncing_Identity...' : 'Processing request...'} +

+ )} +
+
+
+ +
+ + +
- {/* Title */} -

- Query DSGT -

-

- Georgia Tech's largest data science community. Sign in to access your dashboard. -

- - {/* Sign In Button */} - - - {/* Status indicator */} -
-
- - {isRedirecting ? 'Authenticated' : isLoading ? 'Syncing...' : 'Ready'} - +
+
+ +
+
+
+ +
+ DSGT Logo +
+ +
+

+ {isRedirecting ? "Handshake Verified" : status === 'loading' ? "Synchronizing..." : "Core Operational"} +

+
+ +
+ STATUS: {status.toUpperCase()} + + +
+ REGION: ATL-08 + +
+
+
- {/* Footer */} -
);