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

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.
}
},
},
}
)
}