Switched to domain based routing #8
1 changed files with 40 additions and 5 deletions
45
src/App.tsx
45
src/App.tsx
|
|
@ -38,7 +38,37 @@ export default function App() {
|
|||
});
|
||||
}, []);
|
||||
|
||||
// Dynamisch den Dokumententitel (Browsertab-Titel) basierend auf Pfad und Autorendaten anpassen
|
||||
// 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...";
|
||||
|
|
@ -46,9 +76,13 @@ export default function App() {
|
|||
}
|
||||
if (currentPath === "/admin" || currentPath.startsWith("/admin/")) {
|
||||
document.title = "Admin-Zentrale | Autor-Suiten";
|
||||
} else if (currentPath === "/sensual-moments" || currentPath.startsWith("/sensual-moments/")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeSuite = getActiveSuite();
|
||||
if (activeSuite === "erotica") {
|
||||
document.title = authorData.erotica.name || "Marc Velvet";
|
||||
} else if (currentPath === "/clara-finch" || currentPath.startsWith("/clara-finch/")) {
|
||||
} else if (activeSuite === "clara") {
|
||||
document.title = authorData.clara.name || "Clara Finch";
|
||||
} else {
|
||||
document.title = authorData.scifi.name || "Daniel Hesse";
|
||||
|
|
@ -94,10 +128,11 @@ export default function App() {
|
|||
// 4. SciFi Daniel Hesse Portfolio
|
||||
|
||||
const renderActivePortfolio = () => {
|
||||
if (currentPath === "/sensual-moments" || currentPath.startsWith("/sensual-moments/")) {
|
||||
const activeSuite = getActiveSuite();
|
||||
if (activeSuite === "erotica") {
|
||||
return <EroticaPortfolio data={authorData.erotica} />;
|
||||
}
|
||||
if (currentPath === "/clara-finch" || currentPath.startsWith("/clara-finch/")) {
|
||||
if (activeSuite === "clara") {
|
||||
return <ClaraPortfolio data={authorData.clara} />;
|
||||
}
|
||||
return <SciFiPortfolio data={authorData.scifi} />;
|
||||
|
|
|
|||
Loading…
Reference in a new issue