f833d429fc
Backend altyapısı: - 4 yeni Appwrite tablosu: blog_posts, testimonials, seo_pages, seo_settings - Appwrite Storage bucket: kovak-yazilim-media (görsel yüklemeleri) - Appwrite Auth ile session cookie tabanlı koruma Admin paneli (/admin): - Login akışı (email/password) + protected layout - Dashboard: sayım kartları + hızlı aksiyonlar - Blog CRUD: markdown content, kapak görseli, draft/published, SEO alanları - Services CRUD: lucide ikon seçici - Projects CRUD: teknoloji etiketleri, live URL - Testimonials CRUD: puanlama - SEO yöneticisi: global ayarlar + sayfa bazlı override - Mesaj inbox: status filtreleme + güncelleme - Medya kütüphanesi: Appwrite Storage upload/delete Public: - /blog ve /blog/[slug] sayfaları (markdown render) - Anasayfaya Testimonials bölümü - Tüm public sayfalarda generateMetadata + seo_pages override - Header'a Blog linki Route yapısı: - app/(site)/ — public site, Header/Footer ortak - app/admin/login — auth dışı - app/admin/(protected)/ — requireUser() korumalı 23 route üretiliyor, public static, admin dynamic.
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { useActionState } from "react";
|
|
import { loginAction, type LoginState } from "./actions";
|
|
import { AlertCircle, Loader2, LogIn } from "lucide-react";
|
|
|
|
const initial: LoginState = {};
|
|
|
|
export function LoginForm() {
|
|
const [state, action, pending] = useActionState(loginAction, initial);
|
|
|
|
return (
|
|
<form action={action} className="space-y-4">
|
|
<div>
|
|
<label className="text-sm font-medium text-[var(--navy)]">E-posta</label>
|
|
<input
|
|
name="email"
|
|
type="email"
|
|
autoComplete="email"
|
|
required
|
|
className="mt-1.5 w-full rounded-xl border border-[var(--border)] bg-white px-4 py-2.5 text-sm outline-none transition focus:border-[var(--sky)] focus:ring-2 focus:ring-[var(--sky)]/20"
|
|
placeholder="admin@kovakyazilim.com"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label className="text-sm font-medium text-[var(--navy)]">Şifre</label>
|
|
<input
|
|
name="password"
|
|
type="password"
|
|
autoComplete="current-password"
|
|
required
|
|
className="mt-1.5 w-full rounded-xl border border-[var(--border)] bg-white px-4 py-2.5 text-sm outline-none transition focus:border-[var(--sky)] focus:ring-2 focus:ring-[var(--sky)]/20"
|
|
placeholder="••••••••"
|
|
/>
|
|
</div>
|
|
<button
|
|
type="submit"
|
|
disabled={pending}
|
|
className="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-[var(--navy)] px-4 py-2.5 text-sm font-medium text-white transition hover:bg-[var(--navy-700)] disabled:opacity-60"
|
|
>
|
|
{pending ? (
|
|
<Loader2 className="size-4 animate-spin" />
|
|
) : (
|
|
<LogIn className="size-4" />
|
|
)}
|
|
Giriş Yap
|
|
</button>
|
|
{state?.error && (
|
|
<div className="flex items-start gap-2 rounded-xl border border-red-200 bg-red-50 p-3 text-sm text-red-800">
|
|
<AlertCircle className="mt-0.5 size-4 shrink-0" />
|
|
<span>{state.error}</span>
|
|
</div>
|
|
)}
|
|
</form>
|
|
);
|
|
}
|