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.
91 lines
2.6 KiB
TypeScript
91 lines
2.6 KiB
TypeScript
import { Save } from "lucide-react";
|
||
import {
|
||
Checkbox,
|
||
Field,
|
||
FormActions,
|
||
FormShell,
|
||
GhostLink,
|
||
PageHeader,
|
||
PrimaryButton,
|
||
Textarea,
|
||
} from "@/components/admin/form";
|
||
import { saveService } from "@/lib/admin-actions";
|
||
import type { ServiceRow } from "@/lib/types";
|
||
|
||
const ICON_OPTIONS = [
|
||
"Globe",
|
||
"ShoppingCart",
|
||
"Smartphone",
|
||
"Code2",
|
||
"Users",
|
||
"TrendingUp",
|
||
"Share2",
|
||
"Megaphone",
|
||
"Layers",
|
||
];
|
||
|
||
export function ServiceForm({ service }: { service?: ServiceRow }) {
|
||
return (
|
||
<div>
|
||
<PageHeader
|
||
title={service ? "Hizmeti düzenle" : "Yeni hizmet"}
|
||
backHref="/admin/hizmetler"
|
||
/>
|
||
<form action={saveService}>
|
||
{service && <input type="hidden" name="id" value={service.$id} />}
|
||
<FormShell>
|
||
<div className="grid gap-5 md:grid-cols-2">
|
||
<Field label="Başlık" name="title" required defaultValue={service?.title} />
|
||
<Field label="Slug" name="slug" defaultValue={service?.slug} />
|
||
<Field
|
||
label="Sıra"
|
||
name="order"
|
||
type="number"
|
||
defaultValue={service?.order ?? 0}
|
||
/>
|
||
<label className="block">
|
||
<span className="text-sm font-medium text-[var(--navy)]">İkon</span>
|
||
<select
|
||
name="icon"
|
||
defaultValue={service?.icon ?? "Layers"}
|
||
className="mt-1.5 w-full rounded-xl border border-[var(--border)] bg-white px-4 py-2.5 text-sm outline-none focus:border-[var(--sky)] focus:ring-2 focus:ring-[var(--sky)]/20"
|
||
>
|
||
{ICON_OPTIONS.map((i) => (
|
||
<option key={i} value={i}>
|
||
{i}
|
||
</option>
|
||
))}
|
||
</select>
|
||
<span className="mt-1 block text-xs text-[var(--muted)]">
|
||
Lucide icon adı.
|
||
</span>
|
||
</label>
|
||
</div>
|
||
<div className="mt-5">
|
||
<Textarea
|
||
label="Açıklama"
|
||
name="description"
|
||
required
|
||
defaultValue={service?.description}
|
||
rows={4}
|
||
/>
|
||
</div>
|
||
<div className="mt-5">
|
||
<Checkbox
|
||
label="Öne çıkar (Anasayfada göster)"
|
||
name="featured"
|
||
defaultChecked={service?.featured ?? false}
|
||
/>
|
||
</div>
|
||
<FormActions>
|
||
<GhostLink href="/admin/hizmetler">İptal</GhostLink>
|
||
<PrimaryButton>
|
||
<Save className="size-4" /> Kaydet
|
||
</PrimaryButton>
|
||
</FormActions>
|
||
</FormShell>
|
||
</form>
|
||
</div>
|
||
);
|
||
}
|