- Added new dependencies: @daveyplate/better-auth-ui, next-themes, and sonner. - Refactored layout component to use Providers and Toaster for better state management and notifications. - Updated homepage to utilize authClient for session management and improved user experience with navigation links for sign-in and sign-up.
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { authClient } from "@/lib/auth-client";
|
|
import Link from "next/link";
|
|
|
|
export default function Home() {
|
|
const { data: session, isPending } = authClient.useSession();
|
|
|
|
if (isPending) {
|
|
return (
|
|
<main className="flex min-h-screen items-center justify-center">
|
|
<p className="text-muted-foreground">Laden...</p>
|
|
</main>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<main className="flex min-h-screen flex-col items-center justify-center gap-6 p-4">
|
|
<h1 className="text-4xl font-bold">🍋 LemonSpace</h1>
|
|
|
|
{session?.user ? (
|
|
<div className="flex flex-col items-center gap-4">
|
|
<p className="text-lg">
|
|
Willkommen, <span className="font-semibold">{session.user.name}</span>
|
|
</p>
|
|
<Link
|
|
href="/dashboard"
|
|
className="rounded-lg bg-primary px-6 py-3 text-primary-foreground hover:bg-primary/90"
|
|
>
|
|
Zum Dashboard
|
|
</Link>
|
|
</div>
|
|
) : (
|
|
<div className="flex gap-4">
|
|
<Link
|
|
href="/auth/sign-in"
|
|
className="rounded-lg bg-primary px-6 py-3 text-primary-foreground hover:bg-primary/90"
|
|
>
|
|
Anmelden
|
|
</Link>
|
|
<Link
|
|
href="/auth/sign-up"
|
|
className="rounded-lg border border-border px-6 py-3 hover:bg-accent"
|
|
>
|
|
Registrieren
|
|
</Link>
|
|
</div>
|
|
)}
|
|
</main>
|
|
);
|
|
}
|