This commit is contained in:
AyrisAI
2026-07-13 14:42:07 +03:00
parent f37d2b4c39
commit b44acc2678
10 changed files with 551 additions and 60 deletions
+63 -52
View File
@@ -1,32 +1,37 @@
import { mockDb } from '@/lib/mockDb'
import { Link } from '@/i18n/routing'
import { Globe, Calendar, CheckCircle, ExternalLink } from 'lucide-react'
import { Globe, Calendar, CheckCircle, ExternalLink, Plus, Edit } from 'lucide-react'
export default async function AdminWidgetPartnersPage() {
const partners = await mockDb.getWidgetPartners()
return (
<div className="space-y-6">
<div>
<h2 className="text-3xl font-heading font-extrabold text-pine lowercase">widget ortakları (backlinks)</h2>
<p className="text-ink/65 text-xs font-medium mt-1">
Ajans sinerjisi kapsamında Marmaris Local bölgesel öneri widget'ını kendi web sitelerine yerleştiren anlaşmalı işletmeler.
</p>
<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">widget ortakları (harici)</h2>
<p className="text-ink/65 text-xs font-medium mt-1">
Kendi eklediğiniz veya anlaştığınız harici siteler. Bu sitelere widget embed kodunu vererek gösterim yapabilirsiniz.
</p>
</div>
<Link
href="/admin/widget-partners/new"
className="inline-flex items-center justify-center gap-2 bg-pine text-white px-5 py-2.5 rounded-xl font-bold text-sm hover:bg-turquoise transition-colors shadow-sm"
>
<Plus className="w-4 h-4" />
Yeni Ekle
</Link>
</div>
{/* Stats row */}
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="bg-paper p-6 rounded-2xl border border-pine/8 shadow-sm">
<span className="text-[10px] font-mono text-shutter uppercase tracking-wider block mb-1">Toplam Partner</span>
<span className="text-3xl font-heading font-extrabold text-pine leading-none">{partners.length}</span>
</div>
<div className="bg-paper p-6 rounded-2xl border border-pine/8 shadow-sm">
<span className="text-[10px] font-mono text-shutter uppercase tracking-wider block mb-1">Aktif Backlinks</span>
<span className="text-3xl font-heading font-extrabold text-turquoise leading-none">{partners.filter(p => p.widgetSiteUrl).length}</span>
</div>
<div className="bg-paper p-6 rounded-2xl border border-pine/8 shadow-sm">
<span className="text-[10px] font-mono text-shutter uppercase tracking-wider block mb-1">Pilot Bölge</span>
<span className="text-3xl font-heading font-extrabold text-bougainvillea leading-none">yat limanı</span>
<span className="text-[10px] font-mono text-shutter uppercase tracking-wider block mb-1">Aktif Olanlar</span>
<span className="text-3xl font-heading font-extrabold text-turquoise leading-none">{partners.filter(p => p.isActive).length}</span>
</div>
</div>
@@ -36,18 +41,19 @@ export default async function AdminWidgetPartnersPage() {
<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">Mekan</th>
<th className="px-6 py-4 text-left">Mahalle</th>
<th className="px-6 py-4 text-left">Kurulum Tarihi</th>
<th className="px-6 py-4 text-left">Müşteri Web Sitesi</th>
<th className="px-6 py-4 text-left">Site Adı</th>
<th className="px-6 py-4 text-left">Site URL</th>
<th className="px-6 py-4 text-left">Kayıt Tarihi</th>
<th className="px-6 py-4 text-left">Bölge (Opsiyonel)</th>
<th className="px-6 py-4 text-left">Durum</th>
<th className="px-6 py-4 text-right">İşlem</th>
</tr>
</thead>
<tbody className="divide-y divide-dashed divide-pine/8 text-ink/80">
{partners.length === 0 ? (
<tr>
<td colSpan={5} className="px-6 py-12 text-center text-xs text-shutter font-medium">
Henüz widget kurulumu yapılmış partner bulunmuyor.
<td colSpan={6} className="px-6 py-12 text-center text-xs text-shutter font-medium">
Henüz eklenmiş bir widget partneri bulunmuyor.
</td>
</tr>
) : (
@@ -55,45 +61,50 @@ export default async function AdminWidgetPartnersPage() {
return (
<tr key={partner.id} className="hover:bg-stone/20 transition duration-150">
<td className="px-6 py-4 font-medium">
<Link href={`/admin/listings/${partner.id}`} className="font-heading font-bold text-pine lowercase text-sm hover:text-turquoise transition-colors">
{partner.nameTr}
</Link>
<div className="text-[10px] text-shutter font-mono uppercase tracking-wider mt-0.5">{partner.category?.nameTr}</div>
</td>
<td className="px-6 py-4 font-medium text-xs">
{partner.neighborhood?.nameTr}
<span className="font-heading font-bold text-pine lowercase text-sm">
{partner.name}
</span>
</td>
<td className="px-6 py-4 font-mono text-xs">
{partner.widgetInstalledAt ? (
<div className="flex items-center gap-1">
<Calendar className="w-3.5 h-3.5 text-shutter/60" />
{new Date(partner.widgetInstalledAt).toLocaleDateString('tr-TR')}
</div>
) : (
'-'
)}
<a
href={partner.url}
target="_blank"
rel="noopener noreferrer"
className="text-turquoise hover:underline flex items-center gap-1 font-medium"
>
<Globe className="w-3.5 h-3.5 shrink-0" />
{partner.url.replace('https://', '')}
<ExternalLink className="w-3 h-3" />
</a>
</td>
<td className="px-6 py-4 font-mono text-xs">
{partner.widgetSiteUrl ? (
<a
href={partner.widgetSiteUrl}
target="_blank"
rel="noopener noreferrer"
className="text-turquoise hover:underline flex items-center gap-1 font-medium"
>
<Globe className="w-3.5 h-3.5 shrink-0" />
{partner.widgetSiteUrl.replace('https://', '')}
<ExternalLink className="w-3 h-3" />
</a>
) : (
'-'
)}
<div className="flex items-center gap-1">
<Calendar className="w-3.5 h-3.5 text-shutter/60" />
{new Date(partner.createdAt).toLocaleDateString('tr-TR')}
</div>
</td>
<td className="px-6 py-4 font-medium text-xs text-shutter">
{partner.neighborhoodSlug || 'Tümü (Karışık)'}
</td>
<td className="px-6 py-4 whitespace-nowrap">
<span className="inline-flex items-center gap-1 rounded-full bg-paper px-2.5 py-0.5 text-[10px] font-mono font-bold text-turquoise border border-turquoise/20 uppercase tracking-wider">
<CheckCircle className="w-3.5 h-3.5" />
widget aktif
</span>
{partner.isActive ? (
<span className="inline-flex items-center gap-1 rounded-full bg-paper px-2.5 py-0.5 text-[10px] font-mono font-bold text-turquoise border border-turquoise/20 uppercase tracking-wider">
<CheckCircle className="w-3.5 h-3.5" />
Aktif
</span>
) : (
<span className="inline-flex items-center gap-1 rounded-full bg-paper px-2.5 py-0.5 text-[10px] font-mono font-bold text-shutter border border-shutter/20 uppercase tracking-wider">
Pasif
</span>
)}
</td>
<td className="px-6 py-4 whitespace-nowrap text-right">
<Link
href={`/admin/widget-partners/${partner.id}`}
className="inline-flex items-center justify-center p-2 text-shutter hover:text-turquoise hover:bg-turquoise/10 rounded-lg transition-colors"
>
<Edit className="w-4 h-4" />
</Link>
</td>
</tr>
)