assessment-model/src/app/page.tsx
2025-12-08 10:03:40 +00:00

58 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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">
Well 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>
);
}