Elle yazılmış tek-dosya CSS (sabit koyu tema, ham table/button, window.confirm ile silme onayı) yerine tutarlı bir bileşen sistemi: Card/Table/Badge/Button/ Input/Switch/AlertDialog primitifleri, Hanken Grotesk + JetBrains Mono tipografi çifti, "broadcast/monitör" temalı özel bir renk paleti (camgöbeği accent, ok/warn/err/live durum rengi sözlüğü). Tüm sayfalar (dashboard, kanal detay, segmentler, ayarlar, istatistik, kullanıcılar, login) aynı oturumda taşındı — silme onayları artık gerçek AlertDialog, native confirm() değil. Veri akışı/server action'lar değişmedi, tamamen görsel katman. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
import { prisma } from "@streamclipper/db";
|
||
import { bootstrapAdmin, login } from "./actions";
|
||
import { Button } from "@/components/ui/button";
|
||
import { Input } from "@/components/ui/input";
|
||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
||
|
||
export const dynamic = "force-dynamic";
|
||
|
||
export default async function LoginPage({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||
const { error } = await searchParams;
|
||
const userCount = await prisma.user.count();
|
||
const isBootstrap = userCount === 0;
|
||
|
||
return (
|
||
<div className="flex min-h-[60vh] items-center justify-center">
|
||
<Card className="w-full max-w-sm">
|
||
<CardHeader>
|
||
<CardTitle className="text-xl">{isBootstrap ? "İlk Yönetici Hesabını Oluştur" : "Giriş Yap"}</CardTitle>
|
||
{isBootstrap && (
|
||
<CardDescription>Henüz kullanıcı yok — panele erişecek ilk admin hesabını burada oluştur.</CardDescription>
|
||
)}
|
||
</CardHeader>
|
||
<CardContent>
|
||
{!isBootstrap && error && <p className="mb-3 text-sm text-destructive">Kullanıcı adı veya şifre hatalı.</p>}
|
||
<form action={isBootstrap ? bootstrapAdmin : login} className="flex flex-col gap-3">
|
||
<Input name="username" placeholder="Kullanıcı adı" required />
|
||
<Input name="password" type="password" placeholder="Şifre" required minLength={isBootstrap ? 8 : undefined} />
|
||
<Button type="submit">{isBootstrap ? "Hesabı Oluştur" : "Giriş Yap"}</Button>
|
||
</form>
|
||
</CardContent>
|
||
</Card>
|
||
</div>
|
||
);
|
||
}
|