-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,38 @@ | ||
import Link from "next/link"; | ||
import { auth, signOut } from "@sophys-web/auth"; | ||
import { Button, buttonVariants } from "@sophys-web/ui/button"; | ||
import { Input } from "@sophys-web/ui/input"; | ||
import ClickMe from "./_components/click-me"; | ||
|
||
export default async function Page() { | ||
const session = await auth(); | ||
return ( | ||
<main className="flex min-h-screen flex-col items-center justify-between p-24"> | ||
{session ? ( | ||
<div className="flex flex-col items-center gap-4"> | ||
<h1 className="text-4xl font-bold">Welcome {session.user.name}</h1> | ||
<p className="text-lg">Your email is {session.user.email}</p> | ||
</div> | ||
) : null} | ||
<div className="my-auto flex flex-col items-center gap-2"> | ||
<Input placeholder="Enter your email" type="email" /> | ||
<div className="flex gap-1"> | ||
<ClickMe /> | ||
{!session ? ( | ||
<Link | ||
className={buttonVariants({ variant: "link" })} | ||
href="/api/auth/signin" | ||
> | ||
Sign in | ||
</Link> | ||
) : ( | ||
<form | ||
action={async () => { | ||
"use server"; | ||
await signOut(); | ||
}} | ||
> | ||
<Button type="submit" variant="link"> | ||
Sign out | ||
</Button> | ||
</form> | ||
)} | ||
</div> | ||
</div> | ||
<main className="flex flex-col items-center gap-4 p-24"> | ||
<h1 className="text-primary text-4xl font-bold">Sophys Sapucaia UI</h1> | ||
<p className="text-lg"> | ||
This is the UI for experiments conducted at the Sapucaia beamline. | ||
</p> | ||
|
||
{!session ? ( | ||
<> | ||
<p className="text-lg">Please, sign in to continue.</p> | ||
<Link | ||
className={buttonVariants({ variant: "link" })} | ||
href="/api/auth/signin" | ||
> | ||
Sign in | ||
</Link> | ||
</> | ||
) : ( | ||
<form | ||
action={async () => { | ||
"use server"; | ||
await signOut(); | ||
}} | ||
> | ||
<Button type="submit" variant="link"> | ||
Sign out | ||
</Button> | ||
</form> | ||
)} | ||
</main> | ||
); | ||
} |