2035f73e7d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import type { Metadata } from "next";
|
||
import { redirect } from "next/navigation";
|
||
import { Suspense } from "react";
|
||
import { Logo } from "@/components/brand/logo";
|
||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||
import { tr } from "@/i18n/tr";
|
||
import { getCurrentUser } from "@/lib/dal";
|
||
import { LoginForm } from "./login-form";
|
||
|
||
export const metadata: Metadata = { title: tr.auth.loginTitle };
|
||
|
||
/** Oturum açıksa dashboard'a yönlendirir (istek anında, Suspense içinde). */
|
||
async function RedirectIfSignedIn() {
|
||
const user = await getCurrentUser();
|
||
if (user) redirect("/dashboard");
|
||
return null;
|
||
}
|
||
|
||
export default function LoginPage() {
|
||
return (
|
||
<main className="flex w-full max-w-sm flex-col items-center gap-6">
|
||
<Suspense fallback={null}>
|
||
<RedirectIfSignedIn />
|
||
</Suspense>
|
||
<Logo priority className="scale-125" />
|
||
<Card className="w-full">
|
||
<CardHeader>
|
||
<CardTitle className="text-xl">{tr.auth.loginTitle}</CardTitle>
|
||
<CardDescription>{tr.auth.loginDescription}</CardDescription>
|
||
</CardHeader>
|
||
<CardContent>
|
||
<LoginForm />
|
||
</CardContent>
|
||
</Card>
|
||
<p className="text-center text-xs text-muted-foreground">{tr.auth.noSignUp}</p>
|
||
</main>
|
||
);
|
||
}
|