feat: implement dynamic categories, admin category CRUD, fix routing and cleanup

This commit is contained in:
AyrisAI
2026-07-13 13:51:48 +03:00
parent 2f2dafcfb9
commit 5b44c78396
54 changed files with 3619 additions and 473 deletions
+48 -23
View File
@@ -1,42 +1,67 @@
import { mockDb } from '@/lib/mockDb'
import { Link } from '@/i18n/routing'
import { Plus, Edit } from 'lucide-react'
import { DeleteButton } from './DeleteButton'
export default async function AdminNeighborhoodsPage() {
const neighborhoods = await mockDb.getNeighborhoods()
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
<div>
<h2 className="text-3xl font-heading font-extrabold text-pine lowercase">mahalleler</h2>
<p className="text-ink/65 text-xs font-medium mt-1">
Marmaris Local rehberindeki mekanların filtrelendiği mahalle/bölgeler.
</p>
</div>
<Link
href="/admin/neighborhoods/new"
className="inline-flex items-center gap-1.5 bg-turquoise hover:bg-turquoise/90 text-paper text-xs font-bold py-3 px-5 rounded-xl shadow-sm transition active:scale-95 duration-150"
>
<Plus className="w-4 h-4" />
Yeni Mahalle Ekle
</Link>
</div>
<div className="bg-paper border border-pine/8 rounded-2xl shadow-sm overflow-hidden max-w-4xl">
<table className="min-w-full divide-y divide-pine/8 text-sm">
<thead className="bg-stone-deep/40 text-shutter font-mono text-[10px] uppercase tracking-wider">
<tr>
<th className="px-6 py-4 text-left">ID</th>
<th className="px-6 py-4 text-left">Slug</th>
<th className="px-6 py-4 text-left">Adı (TR)</th>
<th className="px-6 py-4 text-left">Name (EN)</th>
<th className="px-6 py-4 text-left">Имя (RU)</th>
</tr>
</thead>
<tbody className="divide-y divide-dashed divide-pine/8 text-ink/85 font-medium">
{neighborhoods.map((neigh) => (
<tr key={neigh.id} className="hover:bg-stone/20 transition duration-150">
<td className="px-6 py-4 font-mono text-xs text-shutter">{neigh.id}</td>
<td className="px-6 py-4 font-mono text-xs font-bold text-turquoise">{neigh.slug}</td>
<td className="px-6 py-4 font-heading font-bold text-pine lowercase text-sm">{neigh.nameTr}</td>
<td className="px-6 py-4 text-xs">{neigh.nameEn}</td>
<td className="px-6 py-4 text-xs">{neigh.nameRu}</td>
<div className="bg-paper border border-pine/8 rounded-2xl shadow-sm overflow-hidden max-w-5xl">
<div className="overflow-x-auto">
<table className="min-w-full divide-y divide-pine/8 text-sm">
<thead className="bg-stone-deep/40 text-shutter font-mono text-[10px] uppercase tracking-wider">
<tr>
<th className="px-6 py-4 text-left">ID</th>
<th className="px-6 py-4 text-left">Slug</th>
<th className="px-6 py-4 text-left">Adı (TR)</th>
<th className="px-6 py-4 text-left">Name (EN)</th>
<th className="px-6 py-4 text-left">Имя (RU)</th>
<th className="px-6 py-4 text-right">İşlemler</th>
</tr>
))}
</tbody>
</table>
</thead>
<tbody className="divide-y divide-dashed divide-pine/8 text-ink/85 font-medium">
{neighborhoods.map((neigh) => (
<tr key={neigh.id} className="hover:bg-stone/20 transition duration-150">
<td className="px-6 py-4 font-mono text-xs text-shutter">{neigh.id}</td>
<td className="px-6 py-4 font-mono text-xs font-bold text-turquoise">{neigh.slug}</td>
<td className="px-6 py-4 font-heading font-bold text-pine lowercase text-sm">{neigh.nameTr}</td>
<td className="px-6 py-4 text-xs">{neigh.nameEn}</td>
<td className="px-6 py-4 text-xs">{neigh.nameRu}</td>
<td className="px-6 py-4 text-right">
<div className="flex justify-end gap-2">
<Link
href={`/admin/neighborhoods/${neigh.id}`}
className="p-2 text-shutter hover:text-turquoise hover:bg-turquoise/10 rounded-lg transition-colors"
title="Düzenle"
>
<Edit className="w-4 h-4" />
</Link>
<DeleteButton id={neigh.id} />
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
)