- Added Sentry integration for error tracking across various components, including error boundaries and user actions. - Updated global error handling to capture exceptions and provide detailed feedback to users. - Enhanced user notifications with toast messages for actions such as credit management, image generation, and canvas exports. - Improved user experience by displaying relevant messages during interactions, ensuring better visibility of system states and errors.
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { authClient } from "@/lib/auth-client";
|
|
import { useRouter } from "next/navigation";
|
|
import Link from "next/link";
|
|
import { toast } from "@/lib/toast";
|
|
import { msg } from "@/lib/toast-messages";
|
|
|
|
export default function Home() {
|
|
const { data: session, isPending } = authClient.useSession();
|
|
const router = useRouter();
|
|
|
|
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>
|
|
<button
|
|
onClick={() => {
|
|
toast.info(msg.auth.signedOut.title);
|
|
void authClient.signOut().then(() => router.refresh());
|
|
}}
|
|
className="rounded-lg border border-border px-6 py-3 text-sm hover:bg-accent"
|
|
>
|
|
Abmelden
|
|
</button>
|
|
</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>
|
|
);
|
|
}
|