feat: integrate Cloudinary image upload, Instagram Feed, and fix Next.js warnings
This commit is contained in:
+13
-7
@@ -6,13 +6,19 @@ import { MapPin, Phone, Send } from 'lucide-react';
|
||||
import { Instagram } from '@/components/InstagramIcon';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function Contact() {
|
||||
export default function Contact({ dbContact }: { dbContact?: any }) {
|
||||
const t = useTranslations('Contact');
|
||||
const [formData, setFormData] = useState({ name: '', date: '', guests: '', message: '' });
|
||||
|
||||
// Fallback to env or translations if dbContact is empty
|
||||
const phoneVal = dbContact?.phone || process.env.NEXT_PUBLIC_WHATSAPP_NUMBER || '905000000000';
|
||||
const addressVal = dbContact?.address || t('address');
|
||||
const instagramVal = dbContact?.instagram || 'https://www.instagram.com/kozmosbeach/';
|
||||
const mapUrlVal = dbContact?.mapUrl || "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d12754.717654763133!2d28.3144!3d36.9507!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14bf76ccf312ba37%3A0xcdaaa97b102b4bb7!2sAkyaka%2C%20Ula%2FMu%C4%9Fla!5e0!3m2!1str!2str!4v1700000000000!5m2!1str!2str";
|
||||
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
const phone = process.env.NEXT_PUBLIC_WHATSAPP_NUMBER || '905000000000';
|
||||
const phone = phoneVal.replace(/[^0-9]/g, '');
|
||||
const text = `*Yeni Rezervasyon Talebi*%0A%0A*Ad Soyad:* ${formData.name}%0A*Tarih:* ${formData.date}%0A*Kişi Sayısı:* ${formData.guests}%0A*Mesaj:* ${formData.message}`;
|
||||
window.open(`https://wa.me/${phone}?text=${text}`, '_blank');
|
||||
};
|
||||
@@ -25,22 +31,22 @@ export default function Contact() {
|
||||
{
|
||||
Icon: MapPin,
|
||||
label: 'Adres',
|
||||
value: t('address'),
|
||||
value: addressVal,
|
||||
color: 'text-coral',
|
||||
bg: 'bg-coral/10',
|
||||
},
|
||||
{
|
||||
Icon: Phone,
|
||||
label: 'Telefon / WhatsApp',
|
||||
value: `+${process.env.NEXT_PUBLIC_WHATSAPP_NUMBER || '90 500 000 00 00'}`,
|
||||
value: `+${phoneVal}`,
|
||||
color: 'text-aqua',
|
||||
bg: 'bg-aqua/10',
|
||||
},
|
||||
{
|
||||
Icon: Instagram,
|
||||
label: 'Instagram',
|
||||
value: '@kozmosbeach',
|
||||
href: 'https://www.instagram.com/kozmosbeach/',
|
||||
value: instagramVal.replace('https://www.instagram.com/', '@').replace('/', ''),
|
||||
href: instagramVal,
|
||||
color: 'text-amber',
|
||||
bg: 'bg-amber/10',
|
||||
},
|
||||
@@ -183,7 +189,7 @@ export default function Contact() {
|
||||
className="min-h-[420px] lg:min-h-[600px] w-full rounded-3xl overflow-hidden shadow-2xl"
|
||||
>
|
||||
<iframe
|
||||
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d12754.717654763133!2d28.3144!3d36.9507!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14bf76ccf312ba37%3A0xcdaaa97b102b4bb7!2sAkyaka%2C%20Ula%2FMu%C4%9Fla!5e0!3m2!1str!2str!4v1700000000000!5m2!1str!2str"
|
||||
src={mapUrlVal}
|
||||
width="100%"
|
||||
height="100%"
|
||||
style={{ border: 0 }}
|
||||
|
||||
Reference in New Issue
Block a user