mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-27 22:45:03 +00:00
58 lines
2.1 KiB
TypeScript
58 lines
2.1 KiB
TypeScript
import { getServerSession } from "next-auth/next";
|
||
import { AuthOptions } from "./api/auth/[...nextauth]/authOptions";
|
||
import GoogleSignInButton from "./components/signin/GoogleSignInButton";
|
||
import EmailSignInButton from "./components/signin/EmailSignInButton";
|
||
import { redirect } from "next/navigation";
|
||
import Image from "next/image";
|
||
|
||
|
||
export default async function Home(props: {
|
||
searchParams: Promise<{ error?: string }>;
|
||
}) {
|
||
const searchParams = await props.searchParams;
|
||
const session = await getServerSession(AuthOptions);
|
||
|
||
if (session?.user) {
|
||
redirect("/home");
|
||
}
|
||
|
||
// Extract the error parameter from the searchParams object
|
||
const error = searchParams.error;
|
||
|
||
return (
|
||
<div className="flex min-h-screen">
|
||
{/* Left Half */}
|
||
<div className="w-1/2 bg-brandblue flex flex-col items-start justify-start p-12">
|
||
<div className="text-white text-3xl font-bold">Energy</div>
|
||
<div className="text-white text-3xl font-bold">Efficiency</div>
|
||
<div className="text-white text-3xl font-bold">Made Easy.</div>
|
||
</div>
|
||
|
||
{/* Right Half */}
|
||
<section className="w-1/2 flex items-center justify-center">
|
||
<div className="w-full max-w-lg p-8 rounded-lg flex flex-col items-center justify-center">
|
||
<Image
|
||
className="mb-8"
|
||
src="/domna_logo_blue_transparent_background.png"
|
||
alt="Logo"
|
||
height={300}
|
||
width={300}
|
||
/>
|
||
<h1 className="text-4xl font-medium text-brandblue mb-8 text-center">
|
||
Your portfolios, managed easily.
|
||
</h1>
|
||
<div className="text-brandmidblue text-lg mb-4">
|
||
We’ll email you a login link — no password required.
|
||
</div>
|
||
|
||
<div className="mb-2 min-w-[19rem]">
|
||
{/* This width has been manually set to align the buttons but should be improved */}
|
||
<EmailSignInButton error={error} />
|
||
</div>
|
||
<div className="text-md"> Sign in with a Social Account</div>
|
||
<GoogleSignInButton />
|
||
</div>
|
||
</section>
|
||
</div>
|
||
);
|
||
}
|