import { useState, useEffect, useCallback } from "react";
import { useLocation } from "wouter";
import { Star, Heart, Briefcase, TrendingUp, ChevronLeft, ChevronRight } from "lucide-react";
import { SIGNS, ELEMENT_COLORS, getHoroscope, getRating } from "@/lib/horoscope-data";
function MiniStars({ count, max = 5 }: { count: number; max?: number }) {
return (
{Array.from({ length: max }).map((_, i) => (
))}
);
}
export function HoroscopeWidget() {
const [, navigate] = useLocation();
const [index, setIndex] = useState(0);
const [paused, setPaused] = useState(false);
const next = useCallback(() => setIndex((i) => (i + 1) % SIGNS.length), []);
const prev = useCallback(() => setIndex((i) => (i - 1 + SIGNS.length) % SIGNS.length), []);
useEffect(() => {
if (paused) return;
const timer = setInterval(next, 6000);
return () => clearInterval(timer);
}, [paused, next]);
const sign = SIGNS[index];
const horoscope = getHoroscope(index);
return (
setPaused(true)}
onMouseLeave={() => setPaused(false)}
onClick={() => navigate("/horoskop")}
data-testid="widget-horoscope"
>
Horoskop
{horoscope.general}
Mehr lesen
{SIGNS.map((_, i) => (
);
}