import { useState, useEffect } from 'react'; import { useLocation } from 'react-router-dom'; import Layout from '@/components/Layout'; import TenReasons from '@/components/TenReasons'; import GeneralNotice from '@/components/GeneralNotice'; import Disclaimer from '@/components/Disclaimer'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion'; import { Mail, Phone, MapPin, Globe, TrendingUp, LineChart, CloudSun, Newspaper, ExternalLink, Star, FileText, Shield, Lock, HelpCircle, Send, User, MessageSquare, MessageCircle, Bot } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useTranslation } from 'react-i18next'; import { sendEmail } from '@/services/emailService'; export default function ContactPage() { const baseUrl = import.meta.env.BASE_URL; const assetUrl = (fileName: string) => `${baseUrl}${encodeURI(fileName)}`; const { t } = useTranslation('contact'); const location = useLocation(); const [yearsOfExperience, setYearsOfExperience] = useState(0); const [activeTab, setActiveTab] = useState('contact'); const [formData, setFormData] = useState({ name: '', email: '', phone: '', subject: '', message: '' }); const [isSubmitting, setIsSubmitting] = useState(false); const [submitStatus, setSubmitStatus] = useState<'idle' | 'success' | 'error'>('idle'); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsSubmitting(true); setSubmitStatus('idle'); try { // Sende E-Mail direkt über Resend API const result = await sendEmail({ name: formData.name, email: formData.email, phone: formData.phone || 'Keine Angabe', subject: formData.subject, message: formData.message, to: 'info@finanzen-mizera.de' }); if (result.success) { setSubmitStatus('success'); // Formular nach kurzer Zeit zurücksetzen setTimeout(() => { setFormData({ name: '', email: '', phone: '', subject: '', message: '' }); setSubmitStatus('idle'); }, 2000); } else { setSubmitStatus('error'); } } catch (error) { console.error('Fehler beim Senden:', error); setSubmitStatus('error'); } finally { setIsSubmitting(false); } }; const [weather, setWeather] = useState<{ temp?: number; wind?: number; time?: string; isLoading: boolean }>({ isLoading: true, }); type NewsItem = { key: string; title: string; content: string }; const fallbackNewsItems: NewsItem[] = [ { key: 'news-1', title: 'Hartz IV - Jak chronić swoje majątki!', content: 'Krótki przegląd kwot wolnych, chronionego majątku i typowych pułapek. Indywidualną ocenę Twojej sytuacji chętnie zbadamy.', }, { key: 'news-2', title: 'Zasiłek rodzicielski', content: 'Ważne podstawy dotyczące uprawnień, wniosku i terminów. Pomagamy dostosować odpowiednią ochronę ubezpieczeniową i planowanie finansowe wokół rodziny i pracy.', }, { key: 'news-3', title: 'Zasiłek rodzinny', content: 'Przegląd uprawnień, dowodów i ważnych terminów. W raz pytań dotyczących zabezpieczenia i zabezpieczenia dzieci chętnie wspieramy.', }, { key: 'news-4', title: 'Dodatek rodzinny', content: 'Krótko wyjaśnione: warunki, droga wniosku i częste pytania. Dajemy orientację, jakie dokumenty są typowo potrzebne.', }, { key: 'news-5', title: 'Reforma zdrowotna - Obowiązek ubezpieczenia od 16 czerwca 2008', content: 'Co oznacza obowiązek ubezpieczenia i jakie opcje istnieją w GKV/PKV? Sprawdzamy z Tobą, które rozwiązanie pasuje do sytuacji życiowej.', }, { key: 'news-6', title: 'Podatek od dochodów kapitałowych jest tu', content: 'Zwięzły przegląd opodatkowania dochodów z kapitału i możliwych wpływu na strategie inwestycyjne i emerytalne. Szczegóły wymagają indywidualnej porady.', }, ]; const translatedNewsItems = t('news.items', { returnObjects: true }) as unknown; const newsItems: NewsItem[] = Array.isArray(translatedNewsItems) ? (translatedNewsItems as NewsItem[]) : fallbackNewsItems; // Berechne die Erfahrungsjahre seit 1994 useEffect(() => { const startYear = 1994; const currentYear = new Date().getFullYear(); setYearsOfExperience(currentYear - startYear); }, []); useEffect(() => { const lat = 51.2446; const lon = 6.8013; const load = async () => { try { setWeather((prev) => ({ ...prev, isLoading: true })); const res = await fetch( `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t=temperature_2m,wind_speed_10m&timezone=Europe%2FBerlin`, ); const data = (await res.json()) as { current?: { time?: string; temperature_2m?: number; wind_speed_10m?: number }; }; setWeather({ isLoading: false, time: data.current?.time, temp: data.current?.temperature_2m, wind: data.current?.wind_speed_10m, }); } catch { setWeather({ isLoading: false }); } }; void load(); }, []); useEffect(() => { const scrollToTabsMenu = () => { const tabsEl = document.getElementById('contact-tabs'); if (!tabsEl) return; const headerEl = document.querySelector('header'); const headerHeight = headerEl?.getBoundingClientRect().height ?? 0; const breadcrumbNav = document.querySelector('nav[aria-label="Breadcrumb"]'); const breadcrumbBar = (breadcrumbNav?.closest('div.border-b') as HTMLElement | null) ?? null; const breadcrumbHeight = breadcrumbBar?.getBoundingClientRect().height ?? 0; const extraGap = 8; const offset = headerHeight + breadcrumbHeight + extraGap; const desiredTop = tabsEl.getBoundingClientRect().top + window.scrollY - offset; const top = Math.max(0, desiredTop); window.scrollTo({ top, behavior: 'smooth' }); }; const handleHash = () => { const raw = window.location.hash; const hash = raw.startsWith('#') ? raw.slice(1) : raw; if (hash === 'card') { setActiveTab('card'); window.setTimeout(() => { scrollToTabsMenu(); }, 0); return; } if (hash === 'contact') { setActiveTab('contact'); window.setTimeout(() => { scrollToTabsMenu(); }, 0); return; } if (hash === 'daily-info') { setActiveTab('daily-info'); window.setTimeout(() => { scrollToTabsMenu(); }, 0); return; } setActiveTab('contact'); }; handleHash(); window.addEventListener('hashchange', handleHash); return () => { window.removeEventListener('hashchange', handleHash); }; }, []); useEffect(() => { const params = new URLSearchParams(location.search); const tab = params.get('tab'); if ( tab && [ 'contact', 'card', 'reasons', 'service', 'impressum', 'leistungen', 'datenschutz', 'links', 'news', 'daily-info', 'faq', ].includes(tab) ) { setActiveTab(tab); window.setTimeout(() => { const tabsEl = document.getElementById('contact-tabs'); if (!tabsEl) return; const headerEl = document.querySelector('header'); const headerHeight = headerEl?.getBoundingClientRect().height ?? 0; const breadcrumbNav = document.querySelector('nav[aria-label="Breadcrumb"]'); const breadcrumbBar = (breadcrumbNav?.closest('div.border-b') as HTMLElement | null) ?? null; const breadcrumbHeight = breadcrumbBar?.getBoundingClientRect().height ?? 0; const extraGap = 8; const offset = headerHeight + breadcrumbHeight + extraGap; const desiredTop = tabsEl.getBoundingClientRect().top + window.scrollY - offset; const top = Math.max(0, desiredTop); window.scrollTo({ top, behavior: 'smooth' }); }, 0); } }, [location.search]); return (

{t('pageTitle', 'Kontakt')}

{ setActiveTab(next); }} className="w-full" id="contact-tabs" >
{t('tabs.contact', 'Kontakt')} {t('tabs.card', 'Karte')} {t('tabs.reasons', 'Gründe')} {t('tabs.service', 'Service')} {t('tabs.impressum', 'Impressum')} {t('tabs.leistungen', 'Leistungen')} {t('tabs.datenschutz', 'Datenschutz')} {t('tabs.links', 'Links')} {t('tabs.news', 'News')} {t('tabs.dailyInfo', 'Info')} {t('tabs.faq', 'FAQ')}
{/* Linke Seite - Kontaktinformationen */}
{t('images.profileAlt',
Marian - Adam Mizera
// {t('profile.role', 'Selbstständiger, unabhängiger Finanz- und Versicherungsmakler')}
{t('profile.qual1', 'Geprüfter Versicherungsfachmann (BWV)')}
{t('profile.qual2', 'Experte Betriebliche Altersversorgung (DVA)')}
{t('profile.qual2Note', '(*Deutsche Versicherungsakademie, München*)')}
{t('licenseTitle', 'Versicherungsmakler')} {t('licenseSuffix', 'mit Erlaubnis')}
{t('licenseLaw', 'nach § 34d Abs. 1 GewO')}
{t('since', 'Versicherungen seit 1994')}
//
{t('office.title', 'HomeOffice:')}
{t('office.note', '(Bürotermine - nach vorheriger telefonischer Vereinbarung)')}
Rosmarinstraße 30 d
40235 Düsseldorf
{t('appointmentNote', 'Termine nach vorheriger telefonischer Vereinbarung.')}
{/* Rechte Seite - Kontaktformular und QR-Code */}

{t('contact.formTitle', 'Kontaktformular')}

{t('contact.formDescription', 'Senden Sie uns eine Nachricht und wir melden uns so schnell wie möglich bei Ihnen zurück.')}

setFormData({...formData, name: e.target.value})} className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm" placeholder={t('contact.namePlaceholder', 'Ihr Name')} required />
setFormData({...formData, email: e.target.value})} className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm" placeholder={t('contact.emailPlaceholder', 'ihre@email.de')} required />
setFormData({...formData, phone: e.target.value})} className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm" placeholder={t('contact.phonePlaceholder', '0123 456789')} />
setFormData({...formData, subject: e.target.value})} className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm" placeholder={t('contact.subjectPlaceholder', 'Ihr Anliegen')} required />