diff --git a/components/auth/protected-route.tsx b/components/auth/protected-route.tsx index 1225cd0..6fae5d2 100644 --- a/components/auth/protected-route.tsx +++ b/components/auth/protected-route.tsx @@ -15,32 +15,27 @@ export default function ProtectedRoute({ children }: ProtectedRouteProps) { const [isChecking, setIsChecking] = useState(true); useEffect(() => { - // If still loading auth state, wait - if (isLoading) { - return; - } + if (isLoading) return; - // Check if user is authenticated const isAuthenticated = !!(token || user); - + if (isAuthenticated) { setIsChecking(false); } else { - // Only redirect if we're not already on the auth page - if (!pathname.includes('/auth/login')) { - console.log('Not authenticated - redirecting to auth'); - // Use replace: false to allow back button to work properly + // Redirect logic for unauthenticated users + if (!pathname.includes("/auth/login")) { + console.log("Not authenticated - redirecting to login"); router.push("/auth/login"); } setIsChecking(false); } }, [user, isLoading, token, router, pathname]); - // Show loading while checking authentication + // Show loading spinner while checking auth if (isLoading || isChecking) { return (
-
+
); } @@ -50,6 +45,6 @@ export default function ProtectedRoute({ children }: ProtectedRouteProps) { return <>{children}; } - // Return null if not authenticated (will redirect) + // Return null if not authenticated (redirect happens) return null; -} \ No newline at end of file +} diff --git a/components/context/AuthContext.tsx b/components/context/AuthContext.tsx index 3a556ec..26e61aa 100644 --- a/components/context/AuthContext.tsx +++ b/components/context/AuthContext.tsx @@ -288,7 +288,7 @@ export const AuthProvider: React.FC = ({ children }) => { setToken(null); setUser(null); setIsLoading(false); - router.push("/auth/login"); + router.push("/"); }; const register = async ( diff --git a/components/landingpage/landing/Footer.tsx b/components/landingpage/landing/Footer.tsx index 4ea4cc9..bc19d92 100644 --- a/components/landingpage/landing/Footer.tsx +++ b/components/landingpage/landing/Footer.tsx @@ -1,89 +1,83 @@ -import { HugeiconsIcon } from "@hugeicons/react"; +import { HugeiconsIcon } from '@hugeicons/react'; import { DiscordFreeIcons, NewTwitterIcon, TelegramFreeIcons, -} from "@hugeicons/core-free-icons"; +} from '@hugeicons/core-free-icons'; -import Link from "next/link"; -import { Button } from "@/components/ui/buttons"; +import Link from 'next/link'; +import { Button } from '@/components/ui/buttons'; export const Footer = () => { - - const footerLinks = [ { - title: "Product", + title: 'Product', links: [ - { name: "Features", href: "#features" }, - { name: "How It Works", href: "#how-it-works" }, - { name: "Privacy Policy", href: "#privacy" }, - { name: "FAQs", href: "#faq" }, - { name: "Contacts", href: "/contact" }, + { name: 'Features', href: '#features' }, + { name: 'How It Works', href: '#how-it-works' }, + { name: 'Privacy Policy', href: '#privacy' }, + { name: 'FAQs', href: '#faq' }, + { name: 'Contacts', href: '/contact' }, ], }, { - title: "Company", + title: 'Company', links: [ - { name: "About", href: "/about" }, - { name: "Blog", href: "/blog" }, - { name: "Careers", href: "#" }, + { name: 'About', href: '/about' }, + { name: 'Blog', href: '/blog' }, + { name: 'Careers', href: '#' }, ], }, { - title: "Legal", + title: 'Legal', links: [ - { name: "Privacy", href: "#privacy" }, - { name: " Terms of Service", href: "#terms" }, - { name: "Security", href: "#" }, + { name: 'Privacy', href: '#privacy' }, + { name: ' Terms of Service', href: '#terms' }, + { name: 'Security', href: '#' }, ], }, - ] - + ]; const socials = [ { - name: "X", + name: 'X', icon: , - link: "https://www.x.com", + link: 'https://www.x.com', }, { - name: "Discord", + name: 'Discord', icon: , - link: "https://www.discord.com", + link: 'https://www.discord.com', }, { - name: "Telegram", + name: 'Telegram', icon: , - link: "https://www.telegram.com", + link: 'https://www.telegram.com', }, ]; - - return ( -