"use client"; import { useEffect, useState } from "react"; import { ZodiacWheel } from "./ZodiacWheel"; /** * Slowly turning wheel with the elapsed time, while the LLM writes. The time * counts from `since` (when the text was asked for), so it does not start * again from zero after a reload; without it, from when the wheel appeared. */ export function AnalysisLoading({ title, text, compact = false, since, }: { title?: string; text: string; compact?: boolean; since?: string; }) { const [start] = useState(() => { const t = since ? Date.parse(since) : NaN; return Number.isNaN(t) ? Date.now() : Math.min(t, Date.now()); }); const [seconds, setSeconds] = useState(() => Math.floor((Date.now() - start) / 1000)); useEffect(() => { const t = setInterval(() => setSeconds(Math.floor((Date.now() - start) / 1000)), 1000); return () => clearInterval(t); }, [start]); const elapsed = `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`; return (
{title && {title}}

{text}

); }