create a comprehensive admin dashbioard with permalink /admin/ and creat

This commit is contained in:
Leon Serfaty G
2025-07-17 10:40:28 +00:00
parent d6e45f10e4
commit a1f3e2b3f5
5 changed files with 246 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
import { LogIn } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { signIn, getSession } from '@/lib/auth';
import { redirect } from 'next/navigation';
export default async function LoginPage() {
const session = await getSession();
if (session) {
redirect('/admin');
}
return (
<div className="flex min-h-screen items-center justify-center bg-background">
<Card className="w-full max-w-sm">
<CardHeader className="text-center">
<CardTitle className="text-2xl">Admin Login</CardTitle>
<CardDescription>Enter your credentials to access the dashboard.</CardDescription>
</CardHeader>
<CardContent>
<form action={signIn} className="grid gap-4">
<div className="grid gap-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
name="email"
placeholder="admin@example.com"
required
defaultValue="admin@example.com"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="password">Password</Label>
<Input
id="password"
type="password"
name="password"
required
defaultValue="password"
/>
</div>
<Button type="submit" className="w-full">
<LogIn className="mr-2 h-4 w-4" /> Sign in
</Button>
</form>
</CardContent>
</Card>
</div>
);
}