mv login page to root page

This commit is contained in:
2025-07-31 23:30:14 +02:00
parent 0812a6b2cb
commit da288f20cd
2 changed files with 34 additions and 18 deletions
+25 -8
View File
@@ -5,6 +5,7 @@ import Link from "next/link";
import { Log } from "oidc-client-ts"; import { Log } from "oidc-client-ts";
import { useAuth } from "react-oidc-context"; import { useAuth } from "react-oidc-context";
import { Nunito } from "next/font/google"; import { Nunito } from "next/font/google";
import { use, useState } from "react";
Log.setLogger(console); Log.setLogger(console);
const nunito = Nunito({ const nunito = Nunito({
@@ -13,28 +14,44 @@ const nunito = Nunito({
}); });
export default function Page() { export default function Page() {
const [userName, setUserName] = useState("Stroop");
const auth = useAuth(); const auth = useAuth();
console.log(auth); console.log(auth);
return ( return (
<main <main className="flex min-h-screen flex-col items-center justify-between p-24">
className={`flex min-h-screen flex-col items-center justify-between p-24`}
>
<div> <div>
<h1 <h1
className={`${nunito.className} text-outline text-[42px] tracking-tighter text-yellow-500`} className={`${nunito.className} text-outline text-[42px] tracking-tighter text-yellow-500`}
> >
Herzlich Willkommen bei Muzak! LOGIN
</h1> </h1>
{auth.isAuthenticated && <></>} </div>
{!auth.isAuthenticated && ( {auth.isAuthenticated && (
<h2 <h2
className={`${nunito.className} text-outline text-[32px] tracking-tighter text-yellow-500`} className={`${nunito.className} text-outline mb-16 text-[32px] tracking-tighter text-yellow-500`}
> >
Bitte authentificeren. Hallo je bent nu ingelogd.
</h2> </h2>
)} )}
{!auth.isAuthenticated && (
<div className="mb-15 flex flex-col items-center justify-between gap-4 rounded-md bg-blue-950/80 p-8">
<p className="text-2xl font-semibold text-white drop-shadow-sm drop-shadow-gray-900">
Welkom, {userName}!
</p>
<button
className="w-full rounded bg-blue-500 px-4 py-2 text-center font-bold text-white hover:bg-blue-400"
onClick={() => void auth.signinRedirect()}
>
<Link href="/nominations" className="w-full">
Inloggen
</Link>
</button>
</div> </div>
)}
<div></div>
</main> </main>
); );
} }
+5 -6
View File
@@ -49,12 +49,12 @@ export default function AuthStatus() {
return ( return (
<div <div
className={`${nunito.className} absolute top-4 right-4 flex items-center gap-2 rounded-lg border-4 border-black bg-white/10 px-3 py-2`} className={`${nunito.className} absolute top-4 right-4 flex items-center gap-2 rounded-lg bg-blue-950/80 px-3 py-2`}
> >
{displayState.isAuthenticated ? ( {displayState.isAuthenticated ? (
<> <>
<div className="h-2 w-2 rounded-full bg-green-500"></div> <div className="h-2 w-2 rounded-full bg-green-500"></div>
<span className="text-sm font-medium"> <span className="text-sm font-medium text-white">
{displayState.user?.profile.name || "Authenticated"} {displayState.user?.profile.name || "Authenticated"}
</span> </span>
<button <button
@@ -62,19 +62,18 @@ export default function AuthStatus() {
void auth.removeUser(); void auth.removeUser();
router.push("/"); router.push("/");
}} }}
className="rounded bg-red-500/20 px-2 py-1 text-xs transition-colors hover:bg-red-500/30" className="ml-1 rounded bg-gray-500/50 px-2 py-1 text-xs transition-colors hover:bg-red-500/30"
> >
Uitloggen Uitloggen
</button> </button>
</> </>
) : ( ) : (
<> <>
<div className="h-2 w-2 rounded-full bg-red-500"></div>
<button <button
onClick={() => void auth.signinRedirect()} onClick={() => void auth.signinRedirect()}
className="rounded bg-blue-500/20 px-2 py-1 text-xs transition-colors hover:bg-blue-500/30" className="rounded px-1 py-2 text-xs"
> >
Inloggen <div className="h-2 w-2 rounded-full bg-red-500"></div>
</button> </button>
</> </>
)} )}