Site için geliştirmeler yapıldı.

This commit is contained in:
2026-01-06 23:45:38 +03:00
parent 96f195ffa6
commit 18023550e0
26 changed files with 971 additions and 56 deletions

0
app/(dashboard)/.gitkeep Normal file
View File

View File

@@ -0,0 +1,130 @@
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { DollarSign, ShoppingCart, Users, CreditCard } from "lucide-react"
export default function DashboardPage() {
return (
<div className="flex-1 space-y-4">
<div className="flex items-center justify-between space-y-2">
<h2 className="text-3xl font-bold tracking-tight">Genel Bakış</h2>
</div>
{/* Stats Grid */}
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Toplam Gelir</CardTitle>
<DollarSign className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">45,231.89</div>
<p className="text-xs text-muted-foreground">+20.1% geçen aya göre</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Abonelikler</CardTitle>
<Users className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">+2350</div>
<p className="text-xs text-muted-foreground">+180.1% geçen aya göre</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Satışlar</CardTitle>
<CreditCard className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">+12,234</div>
<p className="text-xs text-muted-foreground">+19% geçen aya göre</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Aktif Şimdi</CardTitle>
<Users className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">+573</div>
<p className="text-xs text-muted-foreground">+201 son bir saatte</p>
</CardContent>
</Card>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
{/* Recent Sales / Activity */}
<Card className="col-span-4">
<CardHeader>
<CardTitle>Son Hareketler</CardTitle>
<CardDescription>
Bu ay 265+ satış yaptınız.
</CardDescription>
</CardHeader>
<CardContent>
{/* Mock List */}
<div className="space-y-8">
<div className="flex items-center">
<div className="h-9 w-9 rounded-full bg-slate-100 flex items-center justify-center">
<span className="font-bold text-xs">OM</span>
</div>
<div className="ml-4 space-y-1">
<p className="text-sm font-medium leading-none">Ozan Mehmet</p>
<p className="text-sm text-muted-foreground">ozan@email.com</p>
</div>
<div className="ml-auto font-medium">+1,999.00</div>
</div>
<div className="flex items-center">
<div className="h-9 w-9 rounded-full bg-slate-100 flex items-center justify-center">
<span className="font-bold text-xs"></span>
</div>
<div className="ml-4 space-y-1">
<p className="text-sm font-medium leading-none">Ayşe Özdemir</p>
<p className="text-sm text-muted-foreground">ayse@email.com</p>
</div>
<div className="ml-auto font-medium">+39.00</div>
</div>
<div className="flex items-center">
<div className="h-9 w-9 rounded-full bg-slate-100 flex items-center justify-center">
<span className="font-bold text-xs">MK</span>
</div>
<div className="ml-4 space-y-1">
<p className="text-sm font-medium leading-none">Mehmet Kaya</p>
<p className="text-sm text-muted-foreground">mehmet@email.com</p>
</div>
<div className="ml-auto font-medium">+299.00</div>
</div>
</div>
</CardContent>
</Card>
{/* Recent Products or Other Info */}
<Card className="col-span-3">
<CardHeader>
<CardTitle>Son Eklenen Ürünler</CardTitle>
<CardDescription>
Stoğa yeni giren ürünler.
</CardDescription>
</CardHeader>
<CardContent>
<div className="space-y-4">
<div className="flex justify-between items-center bg-slate-50 p-2 rounded">
<span className="text-sm font-medium">Çelik Kasa EV-100</span>
<span className="text-xs bg-green-100 text-green-700 px-2 py-1 rounded">Stokta</span>
</div>
<div className="flex justify-between items-center bg-slate-50 p-2 rounded">
<span className="text-sm font-medium">Ofis Tipi XYZ</span>
<span className="text-xs bg-yellow-100 text-yellow-700 px-2 py-1 rounded">Azaldı</span>
</div>
<div className="flex justify-between items-center bg-slate-50 p-2 rounded">
<span className="text-sm font-medium">Otel Kasası H-20</span>
<span className="text-xs bg-green-100 text-green-700 px-2 py-1 rounded">Stokta</span>
</div>
</div>
</CardContent>
</Card>
</div>
</div>
)
}

View File

@@ -0,0 +1,34 @@
import { createClient } from "@/lib/supabase-server"
import { redirect } from "next/navigation"
import { Sidebar } from "@/components/dashboard/sidebar"
import { DashboardHeader } from "@/components/dashboard/header"
export default async function DashboardLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const supabase = createClient()
const { data: { user } } = await supabase.auth.getUser()
if (!user) {
redirect("/login")
}
return (
<div className="flex min-h-screen w-full flex-col bg-muted/40">
<aside className="fixed inset-y-0 left-0 z-10 hidden w-64 flex-col border-r bg-background sm:flex">
<div className="flex h-14 items-center border-b px-4 lg:h-[60px] lg:px-6">
<span className="font-semibold text-lg">ParaKasa Panel</span>
</div>
<Sidebar className="flex-1" />
</aside>
<div className="flex flex-col sm:gap-4 sm:py-4 sm:pl-64">
<DashboardHeader />
<main className="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8">
{children}
</main>
</div>
</div>
);
}

0
app/(public)/.gitkeep Normal file
View File

View File

@@ -0,0 +1,183 @@
"use client"
import { useState } from "react"
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"
import { Card, CardContent } from "@/components/ui/card"
import { Mail, MapPin, Phone, Loader2, CheckCircle } from "lucide-react"
import { contactFormSchema, ContactFormValues } from "@/lib/schemas"
import { submitContactForm } from "@/lib/actions/contact"
import { toast } from "sonner"
export default function ContactPage() {
const [isSubmitting, setIsSubmitting] = useState(false)
const [isSuccess, setIsSuccess] = useState(false)
const form = useForm<ContactFormValues>({
resolver: zodResolver(contactFormSchema),
defaultValues: {
name: "",
surname: "",
email: "",
phone: "",
subject: "",
message: "",
},
})
async function onSubmit(data: ContactFormValues) {
setIsSubmitting(true)
try {
const response = await submitContactForm(data)
if (response.success) {
setIsSuccess(true)
form.reset()
toast.success("Mesajınız başarıyla gönderildi.")
} else {
toast.error("Hata: " + response.error)
}
} catch (error) {
toast.error("Bir hata oluştu.")
} finally {
setIsSubmitting(false)
}
}
return (
<div className="container py-12 md:py-24">
<div className="text-center mb-12">
<h1 className="text-4xl font-bold tracking-tight mb-4 font-outfit">İletişime Geçin</h1>
<p className="text-muted-foreground max-w-xl mx-auto">
Sorularınız, teklif talepleriniz veya teknik destek için bize ulaşın.
</p>
</div>
<div className="grid md:grid-cols-2 gap-12 max-w-5xl mx-auto">
<div className="space-y-8">
<div className="space-y-6">
<h2 className="text-2xl font-semibold">İletişim Bilgileri</h2>
<div className="flex items-start space-x-4">
<MapPin className="w-6 h-6 text-primary mt-1" />
<div>
<p className="font-medium">Merkez Ofis & Showroom</p>
<p className="text-slate-600 dark:text-slate-400">
Organize Sanayi Bölgesi, 12. Cadde No: 45<br />
Başakşehir, İstanbul
</p>
</div>
</div>
<div className="flex items-center space-x-4">
<Phone className="w-6 h-6 text-primary" />
<div>
<p className="font-medium">Telefon</p>
<p className="text-slate-600 dark:text-slate-400">+90 (212) 555 00 00</p>
</div>
</div>
<div className="flex items-center space-x-4">
<Mail className="w-6 h-6 text-primary" />
<div>
<p className="font-medium">E-posta</p>
<p className="text-slate-600 dark:text-slate-400">info@parakasa.com</p>
</div>
</div>
</div>
<div className="aspect-video bg-slate-100 rounded-lg overflow-hidden relative">
<div className="absolute inset-0 flex items-center justify-center text-muted-foreground">
Harita (Google Maps Embed)
</div>
</div>
</div>
<Card>
<CardContent className="p-6 sm:p-8">
{isSuccess ? (
<div className="flex flex-col items-center justify-center h-full min-h-[400px] text-center space-y-4">
<CheckCircle className="w-16 h-16 text-green-500" />
<h3 className="text-2xl font-bold">Mesajınız Alındı!</h3>
<p className="text-muted-foreground">
En kısa sürede size dönüş yapacağız.
</p>
<Button onClick={() => setIsSuccess(false)} variant="outline">
Yeni Mesaj Gönder
</Button>
</div>
) : (
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<label htmlFor="name" className="text-sm font-medium">Adınız</label>
<Input id="name" {...form.register("name")} placeholder="Adınız" />
{form.formState.errors.name && <p className="text-xs text-red-500">{form.formState.errors.name.message}</p>}
</div>
<div className="space-y-2 w-[210px]">
<label htmlFor="surname" className="text-sm font-medium">Soyadınız</label>
<Input id="surname" {...form.register("surname")} placeholder="Soyadınız" />
{form.formState.errors.surname && <p className="text-xs text-red-500">{form.formState.errors.surname.message}</p>}
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">
<label htmlFor="email" className="text-sm font-medium">E-posta</label>
<Input id="email" type="email" {...form.register("email")} placeholder="ornek@sirket.com" />
{form.formState.errors.email && <p className="text-xs text-red-500">{form.formState.errors.email.message}</p>}
</div>
<div className="space-y-2">
<label htmlFor="phone" className="text-sm font-medium">Telefon</label>
<div className="relative w-[210px]">
<div className="absolute left-3 top-2 text-muted-foreground text-sm flex items-center gap-2 font-medium z-10 select-none pointer-events-none">
<span>🇹🇷</span>
<span>+90</span>
<div className="w-px h-4 bg-border" />
</div>
<Input
id="phone"
type="tel"
className="pl-20 font-mono"
placeholder="(5XX) XXX XX XX"
maxLength={15}
{...form.register("phone", {
onChange: (e) => {
let value = e.target.value.replace(/\D/g, ''); // Remove non-digits
if (value.startsWith('90')) value = value.slice(2); // Remove leading 90 if user types it
// Format: (5XX) XXX XX XX
let formattedValue = '';
if (value.length > 0) formattedValue += '(' + value.substring(0, 3);
if (value.length > 3) formattedValue += ') ' + value.substring(3, 6);
if (value.length > 6) formattedValue += ' ' + value.substring(6, 8);
if (value.length > 8) formattedValue += ' ' + value.substring(8, 10);
e.target.value = formattedValue;
return e;
}
})}
/>
</div>
{form.formState.errors.phone && <p className="text-xs text-red-500">{form.formState.errors.phone.message}</p>}
</div>
</div>
<div className="space-y-2">
<label htmlFor="subject" className="text-sm font-medium">Konu</label>
<Input id="subject" {...form.register("subject")} placeholder="Konu" />
{form.formState.errors.subject && <p className="text-xs text-red-500">{form.formState.errors.subject.message}</p>}
</div>
<div className="space-y-2">
<label htmlFor="message" className="text-sm font-medium">Mesajınız</label>
<Textarea id="message" {...form.register("message")} placeholder="Size nasıl yardımcı olabiliriz?" className="min-h-[120px]" />
{form.formState.errors.message && <p className="text-xs text-red-500">{form.formState.errors.message.message}</p>}
</div>
<Button size="lg" className="w-full" disabled={isSubmitting}>
{isSubmitting && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
Mesaj Gönder
</Button>
</form>
)}
</CardContent>
</Card>
</div>
</div>
)
}

View File

@@ -0,0 +1,58 @@
import Image from "next/image"
export default function CorporatePage() {
return (
<div className="container py-12 md:py-24">
<div className="max-w-4xl mx-auto space-y-12">
<section className="space-y-6 text-center">
<h1 className="text-4xl md:text-5xl font-bold tracking-tight font-outfit">Hakkımızda</h1>
<p className="text-xl text-muted-foreground">
1995'ten beri güvenliğinizi en değerli hazinemiz olarak görüyoruz.
</p>
</section>
<section className="grid md:grid-cols-2 gap-12 items-center">
<div className="aspect-square relative bg-slate-200 rounded-lg overflow-hidden">
{/* Placeholder Image */}
<div className="absolute inset-0 flex items-center justify-center text-muted-foreground">
Şirket Görseli
</div>
</div>
<div className="space-y-6">
<h2 className="text-3xl font-bold">Misyonumuz</h2>
<p className="text-slate-600 dark:text-slate-300 leading-relaxed">
ParaKasa olarak misyonumuz, müşterilerimizin maddi ve manevi değerlerini korumak için
dünya standartlarında güvenlik çözümleri sunmaktır. Teknolojiyi zanaatkarlıkla birleştirerek,
sadece bir metal kutu değil, huzur ve güven üretiyoruz.
</p>
<h2 className="text-3xl font-bold pt-4">Vizyonumuz</h2>
<p className="text-slate-600 dark:text-slate-300 leading-relaxed">
Türkiye'nin lider çelik kasa üreticisi olarak, global pazarda güvenilirlik ve kalite
denince akla gelen ilk marka olmak. Yenilikçi Ar-Ge çalışmalarımızla güvenlik teknolojilerine
yön vermek.
</p>
</div>
</section>
<section className="bg-slate-50 dark:bg-slate-900 p-8 rounded-2xl text-center space-y-4">
<h3 className="text-2xl font-bold">Neden ParaKasa?</h3>
<div className="grid sm:grid-cols-3 gap-6 pt-6">
<div className="p-4">
<div className="text-4xl font-bold text-primary mb-2">25+</div>
<div className="text-sm font-medium">Yıllık Tecrübe</div>
</div>
<div className="p-4">
<div className="text-4xl font-bold text-primary mb-2">10K+</div>
<div className="text-sm font-medium">Mutlu Müşteri</div>
</div>
<div className="p-4">
<div className="text-4xl font-bold text-primary mb-2">%100</div>
<div className="text-sm font-medium">Yerli Üretim</div>
</div>
</div>
</section>
</div>
</div>
)
}

20
app/(public)/layout.tsx Normal file
View File

@@ -0,0 +1,20 @@
import { Navbar } from "@/components/layout/navbar";
import { Footer } from "@/components/layout/footer";
export default function PublicLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<div className="flex flex-col min-h-screen">
<div className="bg-yellow-400 text-yellow-900 text-center py-2 px-4 text-sm font-bold">
SİTE YAPIM AŞAMASINDADIR
</div>
<Navbar />
<main className="flex-1">{children}</main>
<Footer />
</div>
);
}

View File

@@ -88,10 +88,6 @@ export default function LoginPage() {
</CardContent> </CardContent>
<CardFooter className="flex flex-col gap-4 text-center text-sm text-muted-foreground"> <CardFooter className="flex flex-col gap-4 text-center text-sm text-muted-foreground">
<div className="text-center"> <div className="text-center">
Hesabınız yok mu?{" "}
<Link href="/signup" className="underline underline-offset-4 hover:text-primary">
Kayıt Ol
</Link>
</div> </div>
<Link href="/" className="underline underline-offset-4 hover:text-primary"> <Link href="/" className="underline underline-offset-4 hover:text-primary">
Ana Sayfaya Dön Ana Sayfaya Dön

View File

@@ -1,10 +1,14 @@
import Link from "next/link" import Link from "next/link"
import Image from "next/image" import Image from "next/image"
import { ArrowRight, ShieldCheck, Lock, Award, History } from "lucide-react" import { ArrowRight, ShieldCheck, Lock, Award, History, LayoutDashboard, LogIn } from "lucide-react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { createClient } from "@/lib/supabase-server"
export default async function Home() {
const supabase = createClient()
const { data: { user } } = await supabase.auth.getUser()
export default function Home() {
return ( return (
<div className="flex flex-col min-h-screen"> <div className="flex flex-col min-h-screen">
{/* Hero Section */} {/* Hero Section */}
@@ -33,9 +37,14 @@ export default function Home() {
<Button size="lg" className="bg-slate-100 text-slate-900 hover:bg-slate-200 font-semibold text-lg px-8"> <Button size="lg" className="bg-slate-100 text-slate-900 hover:bg-slate-200 font-semibold text-lg px-8">
<Link href="/products">Koleksiyonu İncele</Link> <Link href="/products">Koleksiyonu İncele</Link>
</Button> </Button>
<Button size="lg" variant="outline" className="border-slate-400 text-slate-100 hover:bg-slate-800 hover:text-white font-semibold text-lg px-8"> {user && (
<Link href="/contact">Teklif Al</Link> <Button size="lg" variant="outline" className="border-slate-400 text-slate-100 hover:bg-slate-800 hover:text-white font-semibold text-lg px-8">
</Button> <Link href="/dashboard" className="flex items-center">
<LayoutDashboard className="mr-2 h-5 w-5" />
Panele Git
</Link>
</Button>
)}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,80 @@
import { Card, CardContent, 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() {
return (
<div className="container py-12 md:py-24">
<div className="flex flex-col items-center mb-12 text-center">
<h1 className="text-4xl font-bold tracking-tight mb-4 font-outfit">Ürün Koleksiyonumuz</h1>
<p className="text-muted-foreground max-w-2xl">
Güvenliğiniz için en son teknoloji ile üretilmiş, sertifikalı çelik kasa çözümlerimizi inceleyin.
</p>
</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>
</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>
</div>
</div>
</CardHeader>
<CardFooter className="p-4 pt-0">
<Button className="w-full">Detayları İncele</Button>
</CardFooter>
</Card>
))}
</div>
</div>
)
}

View File

@@ -1,11 +1,8 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { Inter, Outfit } from "next/font/google"; import { Inter, Outfit } from "next/font/google";
import { Navbar } from "@/components/layout/navbar"; import { Toaster } from "sonner";
import { Footer } from "@/components/layout/footer";
import "./globals.css"; import "./globals.css";
const inter = Inter({ subsets: ["latin"] }); const inter = Inter({ subsets: ["latin"] });
const outfit = Outfit({ subsets: ["latin"], variable: "--font-outfit" }); const outfit = Outfit({ subsets: ["latin"], variable: "--font-outfit" });
@@ -24,9 +21,8 @@ export default function RootLayout({
<body <body
className={`${inter.className} ${outfit.variable} antialiased min-h-screen flex flex-col`} className={`${inter.className} ${outfit.variable} antialiased min-h-screen flex flex-col`}
> >
<Navbar /> {children}
<main className="flex-1">{children}</main> <Toaster />
<Footer />
</body> </body>
</html> </html>
); );

View File

@@ -0,0 +1,34 @@
"use client"
import { Menu } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
import { Sidebar } from "@/components/dashboard/sidebar"
import { UserNav } from "@/components/dashboard/user-nav"
export function DashboardHeader() {
return (
<header className="sticky top-0 z-30 flex h-14 items-center gap-4 border-b bg-background px-4 sm:static sm:h-auto sm:border-0 sm:bg-transparent sm:px-6">
<Sheet>
<SheetTrigger asChild>
<Button size="icon" variant="outline" className="sm:hidden">
<Menu className="h-5 w-5" />
<span className="sr-only">Menüyü </span>
</Button>
</SheetTrigger>
<SheetContent side="left" className="w-[240px] sm:max-w-xs">
<nav className="grid gap-6 text-lg font-medium">
<div className="flex items-center gap-2 text-lg font-semibold md:text-base">
ParaKasa Panel
</div>
<Sidebar />
</nav>
</SheetContent>
</Sheet>
<div className="w-full flex-1">
{/* Breadcrumb or Search could go here */}
</div>
<UserNav />
</header>
)
}

View File

@@ -0,0 +1,67 @@
"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { cn } from "@/lib/utils"
import { LayoutDashboard, Package, ShoppingCart, Users, Settings } from "lucide-react"
const sidebarItems = [
{
title: "Panel",
href: "/dashboard",
icon: LayoutDashboard,
},
{
title: "Ürünler",
href: "/dashboard/products",
icon: Package,
},
{
title: "Siparişler",
href: "/dashboard/orders",
icon: ShoppingCart,
},
{
title: "Kullanıcılar",
href: "/dashboard/users",
icon: Users,
},
{
title: "Ayarlar",
href: "/dashboard/settings",
icon: Settings,
},
]
interface SidebarProps extends React.HTMLAttributes<HTMLDivElement> { }
export function Sidebar({ className }: SidebarProps) {
const pathname = usePathname()
return (
<div className={cn("pb-12", className)}>
<div className="space-y-4 py-4">
<div className="px-3 py-2">
<h2 className="mb-2 px-4 text-lg font-semibold tracking-tight">
Yönetim
</h2>
<div className="space-y-1">
{sidebarItems.map((item) => (
<Link
key={item.href}
href={item.href}
className={cn(
"flex items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors",
pathname === item.href ? "bg-slate-100 dark:bg-slate-800 text-primary" : "text-slate-500 dark:text-slate-400"
)}
>
<item.icon className="mr-2 h-4 w-4" />
{item.title}
</Link>
))}
</div>
</div>
</div>
</div>
)
}

View File

@@ -0,0 +1,66 @@
"use client"
import {
Avatar,
AvatarFallback,
AvatarImage,
} from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { supabase } from "@/lib/supabase"
import { useRouter } from "next/navigation"
export function UserNav() {
const router = useRouter()
const handleSignOut = async () => {
await supabase.auth.signOut()
router.push("/login")
router.refresh()
}
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
<Avatar className="h-8 w-8">
<AvatarImage src="/avatars/01.png" alt="@parakasa" />
<AvatarFallback>PK</AvatarFallback>
</Avatar>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" align="end" forceMount>
<DropdownMenuLabel className="font-normal">
<div className="flex flex-col space-y-1">
<p className="text-sm font-medium leading-none">Admin</p>
<p className="text-xs leading-none text-muted-foreground">
admin@parakasa.com
</p>
</div>
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>
Profil
</DropdownMenuItem>
<DropdownMenuItem>
Ayarlar
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={handleSignOut}>
Çıkış Yap
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}

View File

@@ -1,10 +1,14 @@
import Link from "next/link" import Link from "next/link"
import { Search, Menu, Phone } from "lucide-react" import { Search, Menu, Phone, LogIn, User } from "lucide-react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet" import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
import { createClient } from "@/lib/supabase-server"
export async function Navbar() {
const supabase = createClient()
const { data: { user } } = await supabase.auth.getUser()
export function Navbar() {
return ( return (
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
<div className="container flex h-16 items-center"> <div className="container flex h-16 items-center">
@@ -79,6 +83,21 @@ export function Navbar() {
<Button size="sm" className="hidden md:flex"> <Button size="sm" className="hidden md:flex">
Teklif Al Teklif Al
</Button> </Button>
{user ? (
<Button size="sm" variant="ghost" className="h-9 w-9 px-0" asChild>
<Link href="/dashboard">
<User className="h-4 w-4" />
<span className="sr-only">Hesabım</span>
</Link>
</Button>
) : (
<Button size="sm" variant="ghost" className="h-9 w-9 px-0" asChild>
<Link href="/login">
<LogIn className="h-4 w-4" />
<span className="sr-only">Giriş Yap</span>
</Link>
</Button>
)}
</nav> </nav>
</div> </div>
</div> </div>

View File

@@ -2,20 +2,23 @@ import * as React from "react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) { const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
return ( ({ className, type, ...props }, ref) => {
<input return (
type={type} <input
data-slot="input" type={type}
className={cn( className={cn(
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
className className
)} )}
{...props} ref={ref}
/> {...props}
) />
} )
}
)
Input.displayName = "Input"
export { Input } export { Input }

View File

@@ -2,17 +2,20 @@ import * as React from "react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<"textarea">>(
return ( ({ className, ...props }, ref) => {
<textarea return (
data-slot="textarea" <textarea
className={cn( className={cn(
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className className
)} )}
{...props} ref={ref}
/> {...props}
) />
} )
}
)
Textarea.displayName = "Textarea"
export { Textarea } export { Textarea }

19
lib/actions/contact.ts Normal file
View File

@@ -0,0 +1,19 @@
"use server"
import { contactFormSchema, ContactFormValues } from "@/lib/schemas"
export async function submitContactForm(data: ContactFormValues) {
const result = contactFormSchema.safeParse(data)
if (!result.success) {
return { success: false, error: "Geçersiz form verileri." }
}
// Simulate email sending or DB insertion
await new Promise((resolve) => setTimeout(resolve, 1000))
// In a real app, you would use Resend or Nodemailer here
console.log("Contact Form Submitted:", result.data)
return { success: true, message: "Mesajınız başarıyla gönderildi." }
}

12
lib/schemas.ts Normal file
View File

@@ -0,0 +1,12 @@
import { z } from "zod"
export const contactFormSchema = z.object({
name: z.string().min(2, { message: "Ad en az 2 karakter olmalıdır." }),
surname: z.string().min(2, { message: "Soyad en az 2 karakter olmalıdır." }),
email: z.string().email({ message: "Geçerli bir e-posta adresi giriniz." }),
phone: z.string().min(10, { message: "Geçerli bir telefon numarası giriniz (En az 10 hane)." }),
subject: z.string().min(5, { message: "Konu en az 5 karakter olmalıdır." }),
message: z.string().min(10, { message: "Mesaj en az 10 karakter olmalıdır." }),
})
export type ContactFormValues = z.infer<typeof contactFormSchema>

29
lib/supabase-server.ts Normal file
View File

@@ -0,0 +1,29 @@
import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
export function createClient() {
const cookieStore = cookies()
return createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
getAll() {
return cookieStore.getAll()
},
setAll(cookiesToSet) {
try {
cookiesToSet.forEach(({ name, value, options }) =>
cookieStore.set(name, value, options)
)
} catch {
// The `setAll` method was called from a Server Component.
// This can be ignored if you have middleware refreshing
// user sessions.
}
},
},
}
)
}

57
middleware.ts Normal file
View File

@@ -0,0 +1,57 @@
import { createServerClient } from "@supabase/ssr";
import { NextResponse, type NextRequest } from "next/server";
export async function middleware(request: NextRequest) {
let response = NextResponse.next({
request: {
headers: request.headers,
},
});
const supabase = createServerClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
getAll() {
return request.cookies.getAll();
},
setAll(cookiesToSet) {
cookiesToSet.forEach(({ name, value, options }) =>
request.cookies.set(name, value)
);
response = NextResponse.next({
request: {
headers: request.headers,
},
});
cookiesToSet.forEach(({ name, value, options }) =>
response.cookies.set(name, value, options)
);
},
},
}
);
const {
data: { user },
} = await supabase.auth.getUser();
// Protected routes
if (!user && request.nextUrl.pathname.startsWith("/dashboard")) {
return NextResponse.redirect(new URL("/login", request.url));
}
// Redirect to dashboard if logged in and trying to access auth pages
if (user && (request.nextUrl.pathname.startsWith("/login") || request.nextUrl.pathname.startsWith("/signup"))) {
return NextResponse.redirect(new URL("/dashboard", request.url));
}
return response;
}
export const config = {
matcher: [
"/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
],
};

53
package-lock.json generated
View File

@@ -14,6 +14,7 @@
"@radix-ui/react-navigation-menu": "^1.2.14", "@radix-ui/react-navigation-menu": "^1.2.14",
"@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-separator": "^1.1.8",
"@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-slot": "^1.2.4",
"@supabase/ssr": "^0.8.0",
"@supabase/supabase-js": "^2.89.0", "@supabase/supabase-js": "^2.89.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
@@ -22,9 +23,10 @@
"next": "14.2.16", "next": "14.2.16",
"react": "^18", "react": "^18",
"react-dom": "^18", "react-dom": "^18",
"react-hook-form": "^7.69.0", "react-hook-form": "^7.70.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0", "tailwind-merge": "^3.4.0",
"zod": "^4.3.4" "zod": "^4.3.5"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20", "@types/node": "^20",
@@ -1181,6 +1183,18 @@
"node": ">=20.0.0" "node": ">=20.0.0"
} }
}, },
"node_modules/@supabase/ssr": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/@supabase/ssr/-/ssr-0.8.0.tgz",
"integrity": "sha512-/PKk8kNFSs8QvvJ2vOww1mF5/c5W8y42duYtXvkOSe+yZKRgTTZywYG2l41pjhNomqESZCpZtXuWmYjFRMV+dw==",
"license": "MIT",
"dependencies": {
"cookie": "^1.0.2"
},
"peerDependencies": {
"@supabase/supabase-js": "^2.76.1"
}
},
"node_modules/@supabase/storage-js": { "node_modules/@supabase/storage-js": {
"version": "2.89.0", "version": "2.89.0",
"resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.89.0.tgz", "resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.89.0.tgz",
@@ -2522,6 +2536,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/cookie": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
"integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/cross-spawn": { "node_modules/cross-spawn": {
"version": "7.0.6", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -5516,9 +5543,9 @@
} }
}, },
"node_modules/react-hook-form": { "node_modules/react-hook-form": {
"version": "7.69.0", "version": "7.70.0",
"resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.69.0.tgz", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.70.0.tgz",
"integrity": "sha512-yt6ZGME9f4F6WHwevrvpAjh42HMvocuSnSIHUGycBqXIJdhqGSPQzTpGF+1NLREk/58IdPxEMfPcFCjlMhclGw==", "integrity": "sha512-COOMajS4FI3Wuwrs3GPpi/Jeef/5W1DRR84Yl5/ShlT3dKVFUfoGiEZ/QE6Uw8P4T2/CLJdcTVYKvWBMQTEpvw==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"
@@ -6027,6 +6054,16 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/sonner": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",
"integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",
"license": "MIT",
"peerDependencies": {
"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
"react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc"
}
},
"node_modules/source-map-js": { "node_modules/source-map-js": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
@@ -7095,9 +7132,9 @@
} }
}, },
"node_modules/zod": { "node_modules/zod": {
"version": "4.3.4", "version": "4.3.5",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.3.4.tgz", "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.5.tgz",
"integrity": "sha512-Zw/uYiiyF6pUT1qmKbZziChgNPRu+ZRneAsMUDU6IwmXdWt5JwcUfy2bvLOCUtz5UniaN/Zx5aFttZYbYc7O/A==", "integrity": "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==",
"license": "MIT", "license": "MIT",
"funding": { "funding": {
"url": "https://github.com/sponsors/colinhacks" "url": "https://github.com/sponsors/colinhacks"

View File

@@ -15,6 +15,7 @@
"@radix-ui/react-navigation-menu": "^1.2.14", "@radix-ui/react-navigation-menu": "^1.2.14",
"@radix-ui/react-separator": "^1.1.8", "@radix-ui/react-separator": "^1.1.8",
"@radix-ui/react-slot": "^1.2.4", "@radix-ui/react-slot": "^1.2.4",
"@supabase/ssr": "^0.8.0",
"@supabase/supabase-js": "^2.89.0", "@supabase/supabase-js": "^2.89.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
@@ -23,9 +24,10 @@
"next": "14.2.16", "next": "14.2.16",
"react": "^18", "react": "^18",
"react-dom": "^18", "react-dom": "^18",
"react-hook-form": "^7.69.0", "react-hook-form": "^7.70.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0", "tailwind-merge": "^3.4.0",
"zod": "^4.3.4" "zod": "^4.3.5"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20", "@types/node": "^20",
@@ -40,4 +42,4 @@
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
"typescript": "^5" "typescript": "^5"
} }
} }

49
supabase_schema.sql Normal file
View File

@@ -0,0 +1,49 @@
-- Create products table
create table if not exists products (
id bigint primary key generated always as identity,
name text not null,
category text not null,
description text,
image_url text,
price decimal(10,2), -- Optional, validation can start without it
created_at timestamp with time zone default timezone('utc'::text, now()) not null
);
-- Enable RLS
alter table products enable row level security;
-- Policies
-- 1. Public read access
create policy "Public products are viewable by everyone."
on products for select
using ( true );
-- 2. Admin write access (Only authenticated users for now, can be restricted to specific emails/roles later)
create policy "Authenticated users can insert products."
on products for insert
with check ( auth.role() = 'authenticated' );
create policy "Authenticated users can update products."
on products for update
using ( auth.role() = 'authenticated' );
create policy "Authenticated users can delete products."
on products for delete
using ( auth.role() = 'authenticated' );
-- Storage Bucket for Product Images
insert into storage.buckets (id, name, public)
values ('product-images', 'product-images', true)
on conflict (id) do nothing;
create policy "Images are publicly accessible."
on storage.objects for select
using ( bucket_id = 'product-images' );
create policy "Authenticated users can upload images."
on storage.objects for insert
with check ( bucket_id = 'product-images' and auth.role() = 'authenticated' );
create policy "Authenticated users can delete images."
on storage.objects for delete
using ( bucket_id = 'product-images' and auth.role() = 'authenticated' );

12
types/product.ts Normal file
View File

@@ -0,0 +1,12 @@
export type Product = {
id: number
name: string
category: string
description: string | null
image_url: string | null
price: number | null
created_at: string
}
export type ProductInsert = Omit<Product, 'id' | 'created_at'>
export type ProductUpdate = Partial<ProductInsert>