diff --git a/layouts/AuthLayout.tsx b/layouts/AuthLayout.tsx index 0ab423e..c74b0cb 100644 --- a/layouts/AuthLayout.tsx +++ b/layouts/AuthLayout.tsx @@ -1,16 +1,17 @@ -import FlyingThing from "@/components/FlyingThing"; -import Link from "next/link"; -import { ReactNode, useEffect, useState } from "react"; -import { RiLoader5Fill } from "react-icons/ri"; -import { SiGithub } from "react-icons/si"; -import { useRouter } from "next/router"; -import { toast } from "react-hot-toast"; -import Head from "next/head"; +import FlyingThing from '@/components/FlyingThing'; +import Link from 'next/link'; +import { ReactNode, useEffect, useState } from 'react'; +import { RiLoader5Fill } from 'react-icons/ri'; +import { SiGithub } from 'react-icons/si'; +import { useRouter } from 'next/router'; +import { toast } from 'react-hot-toast'; +import Head from 'next/head'; +import Image from 'next/image'; const AuthLayout = ({ children, text, - type = "login", + type = 'login', hideExtras = false, question, hideFlyingThing = false, @@ -18,7 +19,7 @@ const AuthLayout = ({ }: { children: ReactNode; text: string; - type?: "login" | "signup" | "forgot" | "reset"; + type?: 'login' | 'signup' | 'forgot' | 'reset'; hideExtras?: boolean; question?: { title: string; @@ -32,15 +33,15 @@ const AuthLayout = ({ const [loading, setLoading] = useState(false); const handleKeyPress = (e: KeyboardEvent) => { - e.key === "Enter" && setHide(true); + e.key === 'Enter' && setHide(true); }; const router = useRouter(); useEffect(() => { - if (router.asPath === "/login?status=failed") { + if (router.asPath === '/login?status=failed') { setHide(true); - toast.error("Login failed"); + toast.error('Login failed'); } }, []); @@ -49,10 +50,10 @@ const AuthLayout = ({ handleKeyPress(e as unknown as KeyboardEvent); }; - window.addEventListener("keydown", handleKeyDown); + window.addEventListener('keydown', handleKeyDown); return () => { - window.removeEventListener("keydown", handleKeyDown); + window.removeEventListener('keydown', handleKeyDown); }; //Written by ChatGPT //Modified by @xing0x @@ -60,7 +61,7 @@ const AuthLayout = ({ const loginWithGithub = async () => { setLoading(true); - window.open(`${process.env.NEXT_PUBLIC_AUTH_URL}/github`, "_self"); + window.open(`${process.env.NEXT_PUBLIC_AUTH_URL}/github`, '_self'); }; return ( @@ -68,59 +69,55 @@ const AuthLayout = ({
{`Let's fly`}
)}{question?.title}
- {question?.text} + {question?.text}or
Show password
-