bug fixes

This commit is contained in:
allinix 2025-02-18 19:09:28 +05:30
parent 6f692a54a8
commit 5a6c465dab
2 changed files with 35 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import React, { useEffect } from "react"; import React, { useEffect, useState } from "react";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@ -7,12 +7,19 @@ import { usePrivy } from "@privy-io/react-auth";
const signin: React.FC = () => { const signin: React.FC = () => {
const router = useRouter(); const router = useRouter();
const { login, authenticated, ready } = usePrivy(); const { login, authenticated, ready } = usePrivy();
const [isLoading, setIsLoading] = useState(false);
useEffect(() => { useEffect(() => {
if (ready && authenticated) { 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 = () => { const handleAccess = () => {
login(); login();
@ -30,12 +37,22 @@ const signin: React.FC = () => {
</div> </div>
<h1 className="text-xl font-bold text-white">Welcome to Allinix</h1> <h1 className="text-xl font-bold text-white">Welcome to Allinix</h1>
<p className="mb-8 text-gray-400">Get access to dashboard</p> <p className="mb-8 text-gray-400">Get access to dashboard</p>
<button {isLoading ? (
onClick={handleAccess} <div className="w-full space-y-3">
className="btn-primary w-full rounded-md px-4 py-2 font-semibold text-white" <div className="h-1 w-full overflow-hidden rounded-full bg-gray-700">
> <div className="h-full w-1/2 animate-[loading_1s_ease-in-out_infinite] bg-blue-500"></div>
SIGN IN </div>
</button> <p className="text-sm text-gray-400">Redirecting to dashboard...</p>
</div>
) : (
<button
onClick={handleAccess}
className="btn-primary w-full rounded-md px-4 py-2 font-semibold text-white"
disabled={isLoading}
>
SIGN IN
</button>
)}
<div className="mt-8 flex justify-center gap-8"> <div className="mt-8 flex justify-center gap-8">
<Link <Link
href={"https://x.com/allinix_ai"} href={"https://x.com/allinix_ai"}

View File

@ -15,6 +15,15 @@ img {
pointer-events: none; pointer-events: none;
} }
@keyframes loading {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(200%);
}
}
.gradient-text { .gradient-text {
background: linear-gradient(180deg, #fff 0%, #525252 100%); background: linear-gradient(180deg, #fff 0%, #525252 100%);
background-clip: text; background-clip: text;