diff --git a/src/app/signin/_components/AuthenticationProviders.tsx b/src/app/signin/_components/AuthenticationProviders.tsx index 0ca0066..d128c50 100644 --- a/src/app/signin/_components/AuthenticationProviders.tsx +++ b/src/app/signin/_components/AuthenticationProviders.tsx @@ -4,9 +4,10 @@ import { getProviders } from "next-auth/react"; import { useEffect, useMemo, useState } from "react"; import { SignInProviderButton } from "./SignInProviderButton"; import { EmailProviderForm } from "./EmailProviderForm"; -import { Loader2 } from "lucide-react"; import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert"; import { FiAlertTriangle } from "react-icons/fi"; +import { Skeleton } from "~/components/ui/skeleton"; +import { OrSeparator } from "./OrSeparator"; type GetProvidersState = "idle" | "loading" | "success" | "error"; @@ -53,7 +54,14 @@ export function AuthenticationProviders({ }, [providers]); if (["loading", "idle"].includes(getProvidersState)) { - return ; + return ( +
+ + + + +
+ ); } if (getProvidersState === "error") { diff --git a/src/app/signin/_components/EmailProviderForm.tsx b/src/app/signin/_components/EmailProviderForm.tsx index 83c3720..f6e142e 100644 --- a/src/app/signin/_components/EmailProviderForm.tsx +++ b/src/app/signin/_components/EmailProviderForm.tsx @@ -15,6 +15,7 @@ import { FormMessage, } from "~/components/ui/form"; import { Input } from "~/components/ui/input"; +import { OrSeparator } from "./OrSeparator"; const formSchema = z.object({ email: z.string().email("Por favor, insira um e-mail vĂ¡lido"), @@ -39,12 +40,7 @@ export function EmailProviderForm() { className="mt-5 flex flex-col gap-5" onSubmit={form.handleSubmit(onSubmit)} > -
- - ou - -
-
+ + + ou + +
+ + ); +} diff --git a/src/app/signin/page.tsx b/src/app/signin/page.tsx index 3ccace1..47a8795 100644 --- a/src/app/signin/page.tsx +++ b/src/app/signin/page.tsx @@ -1,18 +1,19 @@ +"use client"; import { redirect } from "next/navigation"; -import { getServerAuthSession } from "~/server/auth"; import Image from "next/image"; import { Suspense } from "react"; import { Loader2 } from "lucide-react"; import { Alert, AlertDescription, AlertTitle } from "~/components/ui/alert"; import { FiAlertTriangle } from "react-icons/fi"; import { AuthenticationProviders } from "./_components/AuthenticationProviders"; +import { useSession } from "next-auth/react"; type SignInPageProps = { searchParams: Record; }; -export default async function SignInPage({ searchParams }: SignInPageProps) { - const session = await getServerAuthSession(); +export default function SignInPage({ searchParams }: SignInPageProps) { + const { data: session } = useSession(); if (session) { redirect(searchParams.callbackUrl ?? "/"); @@ -41,7 +42,7 @@ export default async function SignInPage({ searchParams }: SignInPageProps) { )} - + ); }