import { useState, useEffect } from "react"; import { AuthorData } from "./types"; import SciFiPortfolio from "./components/SciFiPortfolio"; import EroticaPortfolio from "./components/EroticaPortfolio"; import ClaraPortfolio from "./components/ClaraPortfolio"; import AdminPanel from "./components/AdminPanel"; import { Lock, Eye, Sparkles, RefreshCw, Leaf } from "lucide-react"; export default function App() { const [authorData, setAuthorData] = useState(null); const [loading, setLoading] = useState(true); const [currentPath, setCurrentPath] = useState(window.location.pathname); // Monitor location changes for custom routing useEffect(() => { const handleLocationChange = () => { setCurrentPath(window.location.pathname); }; // Listen to popstate for navigation back/forward support window.addEventListener("popstate", handleLocationChange); return () => { window.removeEventListener("popstate", handleLocationChange); }; }, []); // Fetch profiles configuration from server useEffect(() => { fetch("/api/author-data") .then((res) => res.json()) .then((data) => { setAuthorData(data); setLoading(false); }) .catch((err) => { console.error("Fehler beim Abrufen der Autoren-Informationen:", err); setLoading(false); }); }, []); // Ermittelt die aktive Suite basierend auf Pfad-Überschreibungen oder dem Domainnamen (Hostname) const getActiveSuite = (): "erotica" | "clara" | "scifi" => { const hostname = window.location.hostname.toLowerCase(); // 1. Pfad-basierte Routen (haben Vorrang, z.B. für die Vorschau oder Admin-Interaktionen) if (currentPath === "/sensual-moments" || currentPath.startsWith("/sensual-moments/")) { return "erotica"; } if (currentPath === "/clara-finch" || currentPath.startsWith("/clara-finch/")) { return "clara"; } if (currentPath === "/sci-fi" || currentPath.startsWith("/sci-fi/")) { return "scifi"; } // 2. Domain-basierte Routen (für den Live-Betrieb hinter einem Reverse Proxy) if (hostname.includes("annieslone.de")) { return "erotica"; } if (hostname.includes("clarafinch.de")) { return "clara"; } if (hostname.includes("hesse-sf.de")) { return "scifi"; } // Standard-Fallback (Daniel Hesse SciFi) return "scifi"; }; // Dynamisch den Dokumententitel (Browsertab-Titel) basierend auf Suite und Autorendaten anpassen useEffect(() => { if (!authorData) { document.title = "Lade Autoren-Portfolio..."; return; } if (currentPath === "/admin" || currentPath.startsWith("/admin/")) { document.title = "Admin-Zentrale | Autor-Suiten"; return; } const activeSuite = getActiveSuite(); if (activeSuite === "erotica") { document.title = authorData.erotica.name || "Marc Velvet"; } else if (activeSuite === "clara") { document.title = authorData.clara.name || "Clara Finch"; } else { document.title = authorData.scifi.name || "Daniel Hesse"; } }, [currentPath, authorData]); const handleAdminLogout = () => { // Relocate to landing site after administration work window.history.pushState({}, "", "/"); setCurrentPath("/"); }; if (loading) { return (

Kryptografisches Terminal bootet...

); } if (!authorData) { return (

Verbindungsfehler

Die Verbindung zum lokalen Datenspeicher-Server konnte nicht hergestellt werden. Bitte vergewissern Sie sich, dass Ihr Express API-Server ordnungsgemäß läuft.

); } // Purely route-based render isolation structure // 1. Administration panel if (currentPath === "/admin" || currentPath.startsWith("/admin/")) { return ; } // 2. Sensual/Erotica Portfolio pseudonym // 3. Poetic Clara Finch Portfolio pseudonym // 4. SciFi Daniel Hesse Portfolio const renderActivePortfolio = () => { const activeSuite = getActiveSuite(); if (activeSuite === "erotica") { return ; } if (activeSuite === "clara") { return ; } return ; }; return ( <> {renderActivePortfolio()} {/* Absolute floating administration bypass link hidden on the bottom left (hover to show) */} ); }