import React, { useState } from "react"; import { useQuery } from "@tanstack/react-query"; // Helper function to generate map coordinates based on address function generateMapUrl(address: any) { // Use coordinates from config or default to Kiel coordinates const lat = address.latitude || 54.3233; const lon = address.longitude || 10.1228; // Generate bounding box around the coordinates (0.05 degrees ≈ 5km radius) const bbox = `${lon - 0.05},${lat - 0.05},${lon + 0.05},${lat + 0.05}`; const embedUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${lat},${lon}`; const fullUrl = `https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}#map=16/${lat}/${lon}`; return { embedUrl, fullUrl }; } export default function LegalPage() { const [activeSection, setActiveSection] = useState<"impressum" | "datenschutz">("impressum"); const { data: legalConfig, isLoading, error } = useQuery({ queryKey: ["legal", "config"], queryFn: async () => { console.log("Fetching legal config..."); try { const response = await fetch("/api/legal-config"); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const result = await response.json(); console.log("Legal config result:", result); return result; } catch (err) { console.error("Legal config error:", err); throw err; } }, retry: false, }); if (isLoading) { return (
Lade rechtliche Informationen...
); } if (error || !legalConfig) { return (

Fehler

Die rechtlichen Informationen konnten nicht geladen werden. {error && ( <>
Fehler: {error.message} )}

Zur Startseite
); } return (
{/* Header */}
window.location.href = '/'} > Stargil Nails Logo

Rechtliche Informationen

Impressum und Datenschutz

{/* Tab Navigation */}
{/* Content */}
{activeSection === "impressum" ? (

Impressum

Anbieter

{legalConfig.companyName}
Inhaber: {legalConfig.ownerName}

Anschrift

{legalConfig.address.street}
{legalConfig.address.postalCode} {legalConfig.address.city}
{legalConfig.address.country}

{/* Map */}
{(() => { const { embedUrl, fullUrl } = generateMapUrl(legalConfig.address); return ( <> ); })()}

Kontakt

Telefon: {legalConfig.contact.phone}
E-Mail: {legalConfig.contact.email}
Website: {legalConfig.contact.website}

{legalConfig.businessDetails.taxId && (

Geschäftliche Angaben

{legalConfig.businessDetails.taxId && ( <>Steuernummer: {legalConfig.businessDetails.taxId}
)} {legalConfig.businessDetails.vatId && ( <>USt-IdNr.: {legalConfig.businessDetails.vatId}
)} {legalConfig.businessDetails.commercialRegister && ( <>Handelsregister: {legalConfig.businessDetails.commercialRegister}
)} Verantwortlich für den Inhalt: {legalConfig.businessDetails.responsibleForContent}

)}

Haftungsausschluss

Die Inhalte unserer Seiten wurden mit größter Sorgfalt erstellt. Für die Richtigkeit, Vollständigkeit und Aktualität der Inhalte können wir jedoch keine Gewähr übernehmen. Als Diensteanbieter sind wir gemäß § 7 Abs.1 TMG für eigene Inhalte auf diesen Seiten nach den allgemeinen Gesetzen verantwortlich.

) : (

Datenschutzerklärung

Verantwortlicher

{legalConfig.dataProtection.responsiblePerson}
E-Mail: {legalConfig.dataProtection.email}

Zweck der Datenverarbeitung

{legalConfig.dataProtection.purpose}

Rechtsgrundlage

{legalConfig.dataProtection.legalBasis}

Datenspeicherung

{legalConfig.dataProtection.dataRetention}

Ihre Rechte

{legalConfig.dataProtection.rights}

Cookies

{legalConfig.dataProtection.cookies}

{legalConfig.dataProtection.thirdPartyServices.length > 0 && (

Drittanbieter-Services

    {legalConfig.dataProtection.thirdPartyServices.map((service, index) => (
  • {service}
  • ))}
)}

Datensicherheit

{legalConfig.dataProtection.dataSecurity}

Kontakt zum Datenschutz

{legalConfig.dataProtection.contactDataProtection}

)}
{/* Back to Home */}
Zurück zur Startseite
); }