Files
Ege Can Komur aa2b7280b6 feat: TR reklam trafiği için anasayfa CRO optimizasyonu
Yeni bölümler ve component'ler:
- WhatsAppFloat: sağ altta her sayfada görünen 'pulse' animasyonlu WhatsApp butonu
- MobileCtaBar: mobilde alt sabit bar — Ara / WhatsApp / Teklif Al üç buton
- TrustBand: hero altı 4 trust kartı (Google ★, proje sayısı, dönüş süresi, garanti)
  + Google rating + yorum sayısı satırı
- LogoCloud: müşteri logoları grayscale strip
- QuickLeadForm: ad + telefon iki alanlı inline mini form (anasayfada)
  - app/actions submitContact 'source' alanını destekliyor (quick lead → message zorunlu değil)
- WhyUs: 4 USP kartı (Hızlı teslim, Yerel destek, Modern tech, Satış sonrası)
- ProcessSteps: 4 adımlı 'nasıl çalışıyoruz' süreç akışı (numaralı timeline)

Schema (JSON-LD):
- OrganizationLd: LocalBusiness + Address + AggregateRating (Google review puanı/sayısı)
- ServiceLd: hizmet detay sayfaları için
- FaqLd: hizmet FAQ'leri için
- BreadcrumbLd, ArticleLd: hazır
Anasayfaya OrganizationLd ekli — Google Ads quality score + organic rich results.

Performans:
- REST GET çağrıları cache:'no-store' yerine next.revalidate=60 (ISR)
- Public sayfalar artık static rendering — LCP düşer
- Mutations ve session GET'ler hâlâ no-store

site_settings yeni alanları (panelden yönetilebilir):
- whatsapp_message (default WhatsApp opener)
- client_logos[] (logo URL listesi)
- trust_items[] (JSON: icon|value|label)
- why_us[] (JSON: icon, title, description)
- process_steps[] (JSON: title, description)
- lead_form_title, lead_form_description
- google_rating, google_review_count, google_review_url

Admin /admin/site formuna yeni 'Conversion / reklam optimizasyonu',
'Neden Biz?' ve 'Süreç adımları' bölümleri eklendi.

Mevcut anasayfa yapısı (üstten alta):
1. Hero
2. TrustBand (mini güven sinyalleri)
3. LogoCloud (varsa müşteri logoları)
4. Hızlı iletişim + QuickLeadForm (2 sütun: tel/WA CTA + mini form)
5. Hizmetler
6. WhyUs (Neden Biz?)
7. ProcessSteps (Nasıl çalışıyoruz?)
8. Projeler
9. Testimonials
10. CTA (Final + WhatsApp)
2026-05-20 03:08:05 +03:00

68 lines
2.3 KiB
TypeScript
Raw Permalink 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.
"use server";
import { DATABASE_ID, ID, TABLES, tablesDB } from "@/lib/appwrite-rest";
export type ContactFormState = {
ok: boolean;
message: string;
errors?: Record<string, string>;
};
const initial: ContactFormState = { ok: false, message: "" };
export async function submitContact(
_prev: ContactFormState = initial,
formData: FormData,
): Promise<ContactFormState> {
const name = String(formData.get("name") ?? "").trim();
const email = String(formData.get("email") ?? "").trim();
const phone = String(formData.get("phone") ?? "").trim();
const subject = String(formData.get("subject") ?? "").trim();
const message = String(formData.get("message") ?? "").trim();
const source = String(formData.get("source") ?? "").trim();
const errors: Record<string, string> = {};
if (!name) errors.name = "Ad zorunlu";
// E-posta YA DA telefon biri yeterli (quick lead form için)
if (!email && !phone) {
errors.email = "E-posta veya telefon zorunlu";
} else if (email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
errors.email = "Geçerli bir e-posta girin";
}
// Tam form değilse message zorunlu değil
const isQuickLead = source.startsWith("quick");
if (!isQuickLead && (!message || message.length < 10)) {
errors.message = "Mesaj en az 10 karakter olmalı";
}
if (Object.keys(errors).length > 0) {
return { ok: false, message: "Lütfen form alanlarını kontrol edin", errors };
}
try {
await tablesDB.createRow(DATABASE_ID, TABLES.contactMessages, ID.unique(), {
name,
email: email || `${phone}@telefon.tr`, // email zorunlu — telefon-only ise placeholder
phone: phone || null,
subject: subject || (isQuickLead ? `Hızlı talep — ${source}` : null),
message:
message ||
(isQuickLead
? `Hızlı lead: ${name}${phone || email}. Geri arama bekleniyor.`
: ""),
status: "new",
});
return {
ok: true,
message: isQuickLead
? "Talebiniz alındı. En kısa sürede sizi arayacağız."
: "Mesajınız iletildi. En kısa sürede dönüş yapacağız.",
};
} catch (err) {
const detail = err instanceof Error ? err.message : "Bilinmeyen hata";
return { ok: false, message: `Kayıt başarısız: ${detail}` };
}
}