'use client'; import React, { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Progress } from 'antd'; interface ProgressIndicatorProps { className?: string; } const sections = ['hero', 'whoosh', 'bzzz', 'slurp', 'cooee', 'integration']; export default function ProgressIndicator({ className = '' }: ProgressIndicatorProps) { const [progress, setProgress] = useState(0); const [currentSection, setCurrentSection] = useState(''); const [isVisible, setIsVisible] = useState(false); useEffect(() => { const handleScroll = () => { const scrollY = window.scrollY; const documentHeight = document.documentElement.scrollHeight - window.innerHeight; const scrollProgress = Math.min((scrollY / documentHeight) * 100, 100); setProgress(scrollProgress); setIsVisible(scrollY > 200); // Find current section const sectionElements = sections.map(section => document.getElementById(section) || document.querySelector('.hero-section') ).filter(Boolean); for (let i = sectionElements.length - 1; i >= 0; i--) { const element = sectionElements[i]; if (element && element.offsetTop <= scrollY + 300) { setCurrentSection(sections[i]); break; } } }; window.addEventListener('scroll', handleScroll); handleScroll(); // Check initial position return () => window.removeEventListener('scroll', handleScroll); }, []); const getSectionTitle = (section: string) => { switch (section) { case 'hero': return 'Welcome to CHORUS'; case 'whoosh': return 'WHOOSH - Orchestration Engine'; case 'bzzz': return 'BZZZ - P2P Coordination'; case 'slurp': return 'SLURP - Context Curator'; case 'cooee': return 'COOEE - Feedback & Learning'; case 'integration': return 'Complete Ecosystem'; default: return 'CHORUS Services'; } }; return ( {isVisible && (
{getSectionTitle(currentSection)}
{Math.round(progress)}% complete
)}
); }