Files
moy-qr/app/admin/(dashboard)/page.tsx
T

107 lines
5.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import prisma from '@/lib/prisma'
import { Package, Tags, Eye, TrendingUp, ChevronRight } from 'lucide-react'
import Link from 'next/link'
export const metadata = {
title: 'Admin Dashboard - Moy Beach',
}
export default async function AdminDashboard() {
const [totalCategories, totalProducts, activeProducts] = await Promise.all([
prisma.categories.count(),
prisma.products.count(),
prisma.products.count({ where: { status: 1 } }),
])
return (
<div className="space-y-8">
<div>
<h1 className="text-3xl font-extrabold text-slate-900 tracking-tight">Dashboard</h1>
<p className="mt-2 text-slate-500">Moy Beach dijital menü yönetim paneline hoş geldiniz.</p>
</div>
{/* Stats Cards */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
<div className="bg-white p-6 rounded-2xl shadow-[0_2px_10px_-3px_rgba(6,81,237,0.1)] border border-slate-100 flex items-center gap-5 transition-all duration-300 hover:shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:-translate-y-0.5 group">
<div className="p-4 bg-gradient-to-br from-blue-50 to-blue-100/50 text-blue-600 rounded-xl group-hover:scale-110 transition-transform duration-300">
<Tags size={28} strokeWidth={1.5} />
</div>
<div>
<p className="text-sm text-slate-500 font-medium">Kategori Sayısı</p>
<p className="text-3xl font-bold text-slate-900 tracking-tight mt-1">{totalCategories}</p>
</div>
</div>
<div className="bg-white p-6 rounded-2xl shadow-[0_2px_10px_-3px_rgba(6,81,237,0.1)] border border-slate-100 flex items-center gap-5 transition-all duration-300 hover:shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:-translate-y-0.5 group">
<div className="p-4 bg-gradient-to-br from-indigo-50 to-indigo-100/50 text-indigo-600 rounded-xl group-hover:scale-110 transition-transform duration-300">
<Package size={28} strokeWidth={1.5} />
</div>
<div>
<p className="text-sm text-slate-500 font-medium">Toplam Ürün</p>
<p className="text-3xl font-bold text-slate-900 tracking-tight mt-1">{totalProducts}</p>
</div>
</div>
<div className="bg-white p-6 rounded-2xl shadow-[0_2px_10px_-3px_rgba(6,81,237,0.1)] border border-slate-100 flex items-center gap-5 transition-all duration-300 hover:shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:-translate-y-0.5 group">
<div className="p-4 bg-gradient-to-br from-emerald-50 to-emerald-100/50 text-emerald-600 rounded-xl group-hover:scale-110 transition-transform duration-300">
<TrendingUp size={28} strokeWidth={1.5} />
</div>
<div>
<p className="text-sm text-slate-500 font-medium">Aktif Ürünler</p>
<p className="text-3xl font-bold text-slate-900 tracking-tight mt-1">{activeProducts}</p>
</div>
</div>
</div>
{/* Quick Actions */}
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div className="bg-white rounded-2xl shadow-[0_2px_10px_-3px_rgba(6,81,237,0.1)] border border-slate-100 overflow-hidden">
<div className="p-6 border-b border-slate-100">
<h2 className="text-lg font-bold text-slate-800">Hızlı Kısayollar</h2>
</div>
<div className="p-3">
<Link href="/admin/products" className="flex items-center justify-between p-4 hover:bg-slate-50 rounded-xl transition-colors group">
<div className="flex items-center gap-4">
<div className="p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-100 transition-colors">
<Package size={20} />
</div>
<div>
<p className="font-semibold text-slate-800">Ürünleri Yönet</p>
<p className="text-sm text-slate-500">Ürün ekle, düzenle veya fiyat güncelle</p>
</div>
</div>
<ChevronRight size={20} className="text-slate-400 group-hover:text-indigo-600 transition-colors" />
</Link>
<Link href="/admin/categories" className="flex items-center justify-between p-4 hover:bg-slate-50 rounded-xl transition-colors group">
<div className="flex items-center gap-4">
<div className="p-2.5 bg-blue-50 text-blue-600 rounded-lg group-hover:bg-blue-100 transition-colors">
<Tags size={20} />
</div>
<div>
<p className="font-semibold text-slate-800">Kategorileri Yönet</p>
<p className="text-sm text-slate-500">Menü kategorilerini ve sıralamasını düzenle</p>
</div>
</div>
<ChevronRight size={20} className="text-slate-400 group-hover:text-blue-600 transition-colors" />
</Link>
<Link href="/" target="_blank" className="flex items-center justify-between p-4 hover:bg-slate-50 rounded-xl transition-colors group">
<div className="flex items-center gap-4">
<div className="p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-100 transition-colors">
<Eye size={20} />
</div>
<div>
<p className="font-semibold text-slate-800">Canlı Menüyü Görüntüle</p>
<p className="text-sm text-slate-500">Müşterilerin gördüğü güncel menüyü </p>
</div>
</div>
<ChevronRight size={20} className="text-slate-400 group-hover:text-emerald-600 transition-colors" />
</Link>
</div>
</div>
</div>
</div>
)
}