first commit

This commit is contained in:
AyrisAI
2026-07-12 20:18:55 +03:00
commit cbc59222c2
65 changed files with 16871 additions and 0 deletions
+124
View File
@@ -0,0 +1,124 @@
'use client'
import { useState } from 'react'
import { submitContactMessageAction } from '@/app/actions'
interface Translations {
name: string
email: string
subject: string
message: string
submit: string
sending: string
success: string
}
interface FormProps {
translations: Translations
}
export default function ContactForm({ translations }: FormProps) {
const [success, setSuccess] = useState(false)
const [error, setError] = useState('')
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
setLoading(true)
setError('')
const formData = new FormData(e.currentTarget)
try {
const res = await submitContactMessageAction(formData)
if (res.error) {
setError(res.error)
} else {
setSuccess(true)
e.currentTarget.reset()
}
} catch (err) {
setError('Bir hata oluştu. Lütfen tekrar deneyin.')
} finally {
setLoading(false)
}
}
if (success) {
return (
<div className="bg-turquoise/10 border border-turquoise/20 text-turquoise p-6 rounded-2xl text-center space-y-3">
<h3 className="font-heading font-bold text-lg lowercase">teşekkürler!</h3>
<p className="text-sm font-medium">{translations.success}</p>
</div>
)
}
return (
<form onSubmit={handleSubmit} className="space-y-6">
{error && (
<div className="bg-bougainvillea/10 border border-bougainvillea/20 text-bougainvillea p-4 rounded-xl text-xs font-semibold">
{error}
</div>
)}
{/* Name */}
<div className="space-y-1.5">
<label className="block text-xs font-mono uppercase tracking-wider text-shutter">{translations.name} *</label>
<input
type="text"
name="name"
required
className="w-full bg-stone border border-pine/10 rounded-xl px-4 py-3 text-sm focus:ring-1 focus:ring-turquoise outline-none text-ink placeholder:text-ink/30"
placeholder="Adınız Soyadınız"
/>
</div>
{/* Email */}
<div className="space-y-1.5">
<label className="block text-xs font-mono uppercase tracking-wider text-shutter">{translations.email} *</label>
<input
type="email"
name="email"
required
className="w-full bg-stone border border-pine/10 rounded-xl px-4 py-3 text-sm focus:ring-1 focus:ring-turquoise outline-none text-ink placeholder:text-ink/30"
placeholder="eposta@adresiniz.com"
/>
</div>
{/* Subject */}
<div className="space-y-1.5">
<label className="block text-xs font-mono uppercase tracking-wider text-shutter">{translations.subject} *</label>
<select
name="subject"
required
className="w-full bg-stone border border-pine/10 rounded-xl px-4 py-3 text-sm focus:ring-1 focus:ring-turquoise outline-none text-ink appearance-none"
>
<option value="">Konu seçin...</option>
<option value="Genel">Genel Sorular</option>
<option value="İşbirliği">İşbirliği</option>
<option value="Hata Bildirimi">Hata Bildirimi</option>
<option value="Diğer">Diğer</option>
</select>
</div>
{/* Message */}
<div className="space-y-1.5">
<label className="block text-xs font-mono uppercase tracking-wider text-shutter">{translations.message} *</label>
<textarea
name="message"
required
rows={5}
className="w-full bg-stone border border-pine/10 rounded-xl px-4 py-3 text-sm focus:ring-1 focus:ring-turquoise outline-none text-ink placeholder:text-ink/30"
placeholder="Mesajınızı buraya yazın..."
/>
</div>
<button
type="submit"
disabled={loading}
className="w-full bg-turquoise hover:bg-turquoise/90 disabled:opacity-75 disabled:cursor-not-allowed text-paper font-bold text-sm py-4.5 px-4 rounded-xl transition duration-300 shadow-sm"
>
{loading ? translations.sending : translations.submit}
</button>
</form>
)
}
+51
View File
@@ -0,0 +1,51 @@
import { getTranslations, setRequestLocale } from 'next-intl/server'
import Navbar from '@/components/Navbar'
import Footer from '@/components/Footer'
import ContactForm from './ContactForm'
interface ContactPageProps {
params: Promise<{ locale: string }>
}
export default async function ContactPage({ params }: ContactPageProps) {
const { locale } = await params
setRequestLocale(locale)
const t = await getTranslations('forms')
const navT = await getTranslations('nav')
return (
<div className="flex-1 flex flex-col min-h-screen bg-stone text-ink">
<Navbar />
<main className="max-w-xl mx-auto px-4 sm:px-6 lg:px-8 py-12 flex-1 w-full">
<div className="bg-paper p-8 rounded-3xl border border-pine/8 shadow-sm">
<div className="mb-8 border-b border-dashed border-pine/8 pb-6">
<h1 className="text-3xl font-heading font-extrabold text-pine lowercase">
{navT('contact')}
</h1>
<p className="text-xs text-shutter font-mono uppercase tracking-wider mt-1.5">
marmaris local bize ulaşın
</p>
</div>
<ContactForm
translations={{
name: t('name'),
email: t('email'),
subject: t('subject'),
message: t('message'),
submit: t('submit'),
sending: t('sending'),
success: t('contactSuccess')
}}
/>
</div>
</main>
<Footer />
</div>
)
}