import { useState, useEffect, useRef } from "react"; import { useQuery } from "@tanstack/react-query"; import { Link, useParams } from "wouter"; import { Star, Heart, Briefcase, TrendingUp, ChevronLeft, ChevronRight, Calendar, CalendarDays, Sparkles, Lightbulb, AlertTriangle, Moon, Sun, ArrowRight, Loader2, } from "lucide-react"; import Header from "@/components/header"; import Footer from "@/components/footer"; import { InArticleAd } from "@/components/adsense"; import { SIGNS, ELEMENT_COLORS, ASTRO_EVENTS, getHoroscope as getStaticHoroscope, getRating, getLuckyNumbers, getDailyColor, } from "@/lib/horoscope-data"; interface AIHoroscope { signIndex: number; signName: string; general: string; love: string; career: string; health: string; tip: string; weekly: string; monthly: string; } function StarRating({ count }: { count: number }) { return (
{Array.from({ length: 5 }).map((_, i) => ( ))}
); } function getEventIcon(icon: string) { switch (icon) { case "mercury": return ; case "moon": return ; case "venus": return ; case "sun": return ; case "saturn": return ; case "newmoon": return ; default: return ; } } function getEventColor(type: string) { switch (type) { case "retrograde": return { bg: "bg-amber-500/10", border: "border-amber-500/20", accent: "text-amber-400" }; case "moon": return { bg: "bg-blue-500/10", border: "border-blue-500/20", accent: "text-blue-400" }; case "transit": return { bg: "bg-pink-500/10", border: "border-pink-500/20", accent: "text-pink-400" }; case "season": return { bg: "bg-emerald-500/10", border: "border-emerald-500/20", accent: "text-emerald-400" }; default: return { bg: "bg-primary/10", border: "border-primary/20", accent: "text-primary" }; } } function AstroEventsSection() { return (

Aktuelle kosmische Ereignisse

{ASTRO_EVENTS.map((event, i) => { const ec = getEventColor(event.type); return (
{getEventIcon(event.icon)}

{event.title}

{event.dateRange}

{event.description}

{event.affectedSigns.map((s) => { const sign = SIGNS.find((x) => x.name === s); return ( {sign?.symbol} {s} ); })}
); })}
); } function SignGrid({ onSelect, selectedIndex, aiHoroscopes }: { onSelect: (i: number) => void; selectedIndex: number | null; aiHoroscopes: AIHoroscope[] }) { return (

Ihr Sternzeichen wählen

{SIGNS.map((sign, i) => { const ec = ELEMENT_COLORS[sign.element]; const aiH = aiHoroscopes.find(h => h.signIndex === i); const horoscope = aiH || getStaticHoroscope(i); const isSelected = selectedIndex === i; return ( ); })}
); } function SignDetail({ signIndex, onNavigate, aiHoroscopes }: { signIndex: number; onNavigate: (i: number) => void; aiHoroscopes: AIHoroscope[] }) { const [tab, setTab] = useState<"daily" | "weekly" | "monthly">("daily"); const sign = SIGNS[signIndex]; const ec = ELEMENT_COLORS[sign.element]; const aiH = aiHoroscopes.find(h => h.signIndex === signIndex); const horoscope = aiH || getStaticHoroscope(signIndex); const luckyNums = getLuckyNumbers(signIndex); const dailyColor = getDailyColor(signIndex); const detailRef = useRef(null); const isAI = !!aiH; const prevIndex = (signIndex - 1 + SIGNS.length) % SIGNS.length; const nextIndex = (signIndex + 1) % SIGNS.length; useEffect(() => { setTab("daily"); }, [signIndex]); return (

{sign.symbol} {sign.name}

{sign.symbol}

{sign.name}

{sign.date}

{sign.element} Planet: {sign.planet} Farbe: {sign.color} Stein: {sign.stone}

Liebe

Beruf

Gesundheit

Glückszahlen

{luckyNums.join(", ")}

Tagesfarbe

{dailyColor}

Kompatibel

{sign.compatible.join(", ")}

{(["daily", "weekly", "monthly"] as const).map((t) => ( ))}
{tab === "daily" && (

Allgemein

{horoscope.general}

Liebe & Partnerschaft

{horoscope.love}

)} {tab === "weekly" && (

Wochenhoroskop

{horoscope.weekly}

)} {tab === "monthly" && (

Monatshoroskop

{horoscope.monthly}

)}
{tab === "daily" && (

Beruf & Finanzen

{horoscope.career}

Gesundheit & Wohlbefinden

{horoscope.health}

Tipp des Tages: {horoscope.tip}

)}

Weitere Sternzeichen entdecken

{SIGNS.filter((_, i) => i !== signIndex).map((s) => { const origIdx = SIGNS.findIndex((x) => x.name === s.name); const sEc = ELEMENT_COLORS[s.element]; return ( ); })}
); } export default function HoroscopePage() { const params = useParams<{ sign?: string }>(); const [selected, setSelected] = useState(null); const detailRef = useRef(null); const { data: aiHoroscopes = [], isLoading: aiLoading } = useQuery({ queryKey: ["/api/horoscopes/today"], }); useEffect(() => { if (params.sign) { const idx = SIGNS.findIndex((s) => s.name.toLowerCase() === params.sign?.toLowerCase()); if (idx >= 0) setSelected(idx); } }, [params.sign]); const handleSelect = (i: number) => { setSelected(i); setTimeout(() => { detailRef.current?.scrollIntoView({ behavior: "smooth", block: "start" }); }, 100); }; return (

Horoskop

Entdecken Sie, was die Sterne für Sie bereithalten. Aktuelle kosmische Ereignisse und Ihr persönliches Tageshoroskop.

{aiLoading && (
Horoskope werden von den Sternen gelesen...
)}
{selected !== null ? ( ) : (

Wählen Sie oben Ihr Sternzeichen

für Ihr persönliches Tages-, Wochen- und Monatshoroskop

)}
); }