güncelleme

This commit is contained in:
2026-01-29 16:49:51 +03:00
parent 10bfa3089e
commit 54113726f4
38 changed files with 1469 additions and 642 deletions

View File

@@ -1,48 +1,30 @@
import { createClient } from "@/lib/supabase-server"
import { Card, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import Image from "next/image"
const products = [
{
id: 1,
name: "Ev Tipi Çelik Kasa",
image: "/images/safe-1.jpg",
category: "Ev",
},
{
id: 2,
name: "Ofis Tipi Yanmaz Kasa",
image: "/images/safe-2.jpg",
category: "Ofis",
},
{
id: 3,
name: "Otel Odası Kasası",
image: "/images/safe-3.jpg",
category: "Otel",
},
{
id: 4,
name: "Silah Kasası (Tüfek)",
image: "/images/safe-4.jpg",
category: "Özel",
},
{
id: 5,
name: "Kuyumcu Kasası",
image: "/images/safe-5.jpg",
category: "Ticari",
},
{
id: 6,
name: "Duvar İçi Gizli Kasa",
image: "/images/safe-6.jpg",
category: "Ev",
},
]
export default function ProductsPage() {
// Helper to get products
async function getProducts() {
const supabase = createClient()
const { data, error } = await supabase
.from("products")
.select("*")
.eq("is_active", true)
.order("created_at", { ascending: false })
if (error) {
console.error("Error fetching products:", error)
return []
}
return data
}
export default async function ProductsPage() {
const products = await getProducts()
return (
<div className="container py-12 md:py-24">
<div className="flex flex-col items-center mb-12 text-center">
@@ -53,27 +35,44 @@ export default function ProductsPage() {
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
{products.map((product) => (
<Card key={product.id} className="overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300">
<div className="aspect-[4/5] relative bg-slate-100 dark:bg-slate-800">
{/* Placeholder for real images */}
<div className="absolute inset-0 flex items-center justify-center text-slate-400">
<span className="text-sm">Görsel: {product.name}</span>
{products && products.length > 0 ? (
products.map((product) => (
<Card key={product.id} className="overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 group">
<div className="aspect-[4/5] relative bg-slate-100 dark:bg-slate-800">
{product.image_url ? (
<Image
src={product.image_url}
alt={product.name}
fill
className="object-cover transition-transform duration-500 group-hover:scale-105"
/>
) : (
<div className="absolute inset-0 flex items-center justify-center text-slate-400">
<span className="text-sm">Görsel Yok</span>
</div>
)}
</div>
</div>
<CardHeader className="p-4">
<div className="flex justify-between items-start">
<div>
<span className="text-xs font-medium text-slate-500 uppercase tracking-wider">{product.category}</span>
<CardTitle className="text-lg mt-1">{product.name}</CardTitle>
<CardHeader className="p-4">
<div className="flex justify-between items-start">
<div className="w-full">
<div className="flex justify-between items-center w-full">
<span className="text-xs font-medium text-slate-500 uppercase tracking-wider">{product.category}</span>
<span className="font-bold text-lg text-primary">{product.price}</span>
</div>
<CardTitle className="text-lg mt-1">{product.name}</CardTitle>
</div>
</div>
</div>
</CardHeader>
<CardFooter className="p-4 pt-0">
<Button className="w-full">Detayları İncele</Button>
</CardFooter>
</Card>
))}
</CardHeader>
<CardFooter className="p-4 pt-0">
<Button className="w-full" variant="outline">Detayları İncele</Button>
</CardFooter>
</Card>
))
) : (
<div className="col-span-full text-center py-12">
<p className="text-muted-foreground">Henüz vitrinde ürünümüz bulunmuyor.</p>
</div>
)}
</div>
</div>
)