From 5a6c465dab0867442b408ca7f903587b48881a46 Mon Sep 17 00:00:00 2001 From: allinix Date: Tue, 18 Feb 2025 19:09:28 +0530 Subject: [PATCH] bug fixes --- next/src/pages/index.tsx | 35 ++++++++++++++++++++++++++--------- next/src/styles/globals.css | 9 +++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/next/src/pages/index.tsx b/next/src/pages/index.tsx index ace8f1c..1b7b0f7 100644 --- a/next/src/pages/index.tsx +++ b/next/src/pages/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React, { useEffect, useState } from "react"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/navigation"; @@ -7,12 +7,19 @@ import { usePrivy } from "@privy-io/react-auth"; const signin: React.FC = () => { const router = useRouter(); const { login, authenticated, ready } = usePrivy(); + const [isLoading, setIsLoading] = useState(false); useEffect(() => { if (ready && authenticated) { - router.push("/chat"); + setIsLoading(true); + // Add a small delay to ensure smooth transition + const redirectTimer = setTimeout(() => { + router.push("/chat"); + }, 2000); + + return () => clearTimeout(redirectTimer); } - }, [authenticated, ready, router]); + }, [authenticated, router]); const handleAccess = () => { login(); @@ -30,12 +37,22 @@ const signin: React.FC = () => {

Welcome to Allinix

Get access to dashboard

- + {isLoading ? ( +
+
+
+
+

Redirecting to dashboard...

+
+ ) : ( + + )}