feat: admin paneli + blog + testimonials + SEO yöneticisi

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.
This commit is contained in:
Ege Can Komur
2026-05-20 02:13:09 +03:00
parent 0f20309e4d
commit f833d429fc
52 changed files with 2999 additions and 81 deletions
@@ -0,0 +1,16 @@
import { notFound } from "next/navigation";
import { getRow } from "@/lib/data";
import { TABLES } from "@/lib/appwrite-server";
import type { BlogPostRow } from "@/lib/types";
import { BlogForm } from "../../form";
export default async function EditBlogPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const post = await getRow<BlogPostRow>(TABLES.blogPosts, id);
if (!post) notFound();
return <BlogForm post={post} />;
}
+137
View File
@@ -0,0 +1,137 @@
import {
Field,
FormActions,
FormShell,
GhostLink,
PageHeader,
PrimaryButton,
Select,
Textarea,
} from "@/components/admin/form";
import { saveBlogPost } from "@/lib/admin-actions";
import type { BlogPostRow } from "@/lib/types";
import { Save } from "lucide-react";
export function BlogForm({ post }: { post?: BlogPostRow }) {
return (
<div>
<PageHeader
title={post ? "Yazıyı düzenle" : "Yeni yazı"}
backHref="/admin/blog"
description="Markdown formatında içerik yazabilirsiniz."
/>
<form action={saveBlogPost}>
{post && <input type="hidden" name="id" value={post.$id} />}
<FormShell>
<div className="grid gap-5 md:grid-cols-2">
<Field
label="Başlık"
name="title"
required
defaultValue={post?.title}
placeholder="Yazı başlığı"
/>
<Field
label="Slug"
name="slug"
defaultValue={post?.slug}
placeholder="otomatik-uretilir"
help="Boş bırakırsanız başlıktan üretilir."
/>
<Field label="Yazar" name="author" defaultValue={post?.author} />
<Select
label="Durum"
name="status"
defaultValue={post?.status ?? "draft"}
options={[
{ value: "draft", label: "Taslak" },
{ value: "published", label: "Yayında" },
]}
/>
<Field
label="Yayın tarihi (ISO)"
name="published_at"
type="datetime-local"
defaultValue={post?.published_at?.slice(0, 16)}
help="Boş bırakırsanız yayına alındığı an kullanılır."
/>
<Field
label="Etiketler"
name="tags"
defaultValue={post?.tags?.join(", ")}
placeholder="seo, web tasarım, kocaeli"
help="Virgülle ayırın."
/>
</div>
<div className="mt-5 space-y-5">
<Textarea
label="Özet"
name="excerpt"
defaultValue={post?.excerpt}
rows={3}
placeholder="Liste/kart görünümünde gösterilecek kısa özet"
/>
<Textarea
label="İçerik (Markdown)"
name="content"
defaultValue={post?.content}
rows={14}
placeholder={"# Başlık\n\nMarkdown desteklenir…"}
/>
<Field
label="Kapak görseli URL"
name="cover_image"
type="url"
defaultValue={post?.cover_image}
placeholder="https://…"
help="Medya kütüphanesinden bir görselin view URL'ini yapıştırın."
/>
<Field
label="Kapak file_id"
name="cover_file_id"
defaultValue={post?.cover_file_id}
help="(opsiyonel) Appwrite storage file ID'si"
/>
</div>
<h3 className="mt-8 text-sm font-semibold uppercase tracking-wider text-[var(--muted)]">
SEO
</h3>
<div className="mt-3 grid gap-5 md:grid-cols-2">
<Field
label="SEO başlığı"
name="seo_title"
defaultValue={post?.seo_title}
help="Boş bırakırsanız yazı başlığı kullanılır."
/>
<Field
label="SEO OG görseli"
name="seo_image"
type="url"
defaultValue={post?.seo_image}
/>
</div>
<div className="mt-5">
<Textarea
label="SEO açıklaması"
name="seo_description"
defaultValue={post?.seo_description}
rows={2}
help="150160 karakter ideal."
/>
</div>
<FormActions>
<GhostLink href="/admin/blog">İptal</GhostLink>
<PrimaryButton>
<Save className="size-4" /> Kaydet
</PrimaryButton>
</FormActions>
</FormShell>
</form>
</div>
);
}
+5
View File
@@ -0,0 +1,5 @@
import { BlogForm } from "../form";
export default function NewBlogPostPage() {
return <BlogForm />;
}
+103
View File
@@ -0,0 +1,103 @@
import Link from "next/link";
import { Plus, Edit, ExternalLink } from "lucide-react";
import { PageHeader } from "@/components/admin/form";
import { DeleteButton } from "@/components/admin/delete-button";
import { listAllPosts } from "@/lib/data";
import { deleteBlogPost } from "@/lib/admin-actions";
export default async function BlogListPage() {
const posts = await listAllPosts();
return (
<div>
<PageHeader
title="Blog"
description="Yazılarınızı yönetin ve yayınlayın."
action={
<Link
href="/admin/blog/new"
className="inline-flex items-center gap-2 rounded-full bg-[var(--navy)] px-4 py-2 text-sm font-medium text-white transition hover:bg-[var(--navy-700)]"
>
<Plus className="size-4" /> Yeni yazı
</Link>
}
/>
<div className="mt-6 overflow-hidden rounded-2xl border border-[var(--border)] bg-white">
<table className="w-full text-sm">
<thead className="bg-[var(--navy-50)] text-xs uppercase tracking-wider text-[var(--muted)]">
<tr>
<th className="px-4 py-3 text-left">Başlık</th>
<th className="px-4 py-3 text-left">Slug</th>
<th className="px-4 py-3 text-left">Durum</th>
<th className="px-4 py-3 text-left">Yayın</th>
<th className="px-4 py-3 text-right">İşlem</th>
</tr>
</thead>
<tbody>
{posts.length === 0 && (
<tr>
<td colSpan={5} className="px-4 py-12 text-center text-[var(--muted)]">
Henüz yazı yok. İlk yazınızı oluşturun.
</td>
</tr>
)}
{posts.map((p) => (
<tr key={p.$id} className="border-t border-[var(--border)]">
<td className="px-4 py-3 font-medium text-[var(--navy)]">{p.title}</td>
<td className="px-4 py-3 text-[var(--muted)]">/{p.slug}</td>
<td className="px-4 py-3">
<StatusBadge status={p.status} />
</td>
<td className="px-4 py-3 text-[var(--muted)]">
{p.published_at
? new Date(p.published_at).toLocaleDateString("tr-TR")
: "—"}
</td>
<td className="px-4 py-3">
<div className="flex items-center justify-end gap-2">
{p.status === "published" && (
<Link
href={`/blog/${p.slug}`}
target="_blank"
className="rounded-md border border-[var(--border)] p-1.5 text-[var(--muted)] hover:text-[var(--navy)]"
>
<ExternalLink className="size-3.5" />
</Link>
)}
<Link
href={`/admin/blog/${p.$id}/edit`}
className="inline-flex items-center gap-1 rounded-md border border-[var(--border)] bg-white px-2.5 py-1.5 text-xs font-medium text-[var(--navy)] hover:bg-[var(--navy-50)]"
>
<Edit className="size-3.5" />
Düzenle
</Link>
<form action={deleteBlogPost}>
<input type="hidden" name="id" value={p.$id} />
<DeleteButton />
</form>
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
}
function StatusBadge({ status }: { status?: string | null }) {
const isPub = status === "published";
return (
<span
className={`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
isPub
? "bg-green-100 text-green-800"
: "bg-amber-100 text-amber-800"
}`}
>
{isPub ? "Yayında" : "Taslak"}
</span>
);
}