'use client'; import Link from 'next/link'; import { useEffect, useRef, useState } from 'react'; import styles from './Hero.module.css'; export default function Hero() { const canvasRef = useRef(null); const heroRef = useRef(null); const [typedText, setTypedText] = useState(''); const [cursorTrail, setCursorTrail] = useState>([]); const [stats, setStats] = useState({ users: 0, posts: 0, rating: 0 }); const fullText = 'Manage All Your Social Media in One Place'; // Typing animation useEffect(() => { let index = 0; const timer = setInterval(() => { if (index <= fullText.length) { setTypedText(fullText.slice(0, index)); index++; } else { clearInterval(timer); } }, 50); return () => clearInterval(timer); }, []); // Stats counter animation useEffect(() => { const duration = 2000; const steps = 60; const interval = duration / steps; let step = 0; const timer = setInterval(() => { step++; const progress = step / steps; setStats({ users: Math.floor(10000 * progress), posts: Math.floor(1000000 * progress), rating: Math.min(4.9, 4.9 * progress), }); if (step >= steps) clearInterval(timer); }, interval); return () => clearInterval(timer); }, []); // Enhanced particle system - Cleaner & Performance Optimized useEffect(() => { const canvas = canvasRef.current; if (!canvas) return; const ctx = canvas.getContext('2d'); if (!ctx) return; canvas.width = window.innerWidth; canvas.height = window.innerHeight; const particles: Array<{ x: number; y: number; size: number; speedX: number; speedY: number; color: string; opacity: number; }> = []; // Reduced particle count for a cleaner look for (let i = 0; i < 60; i++) { const colors = [ 'rgba(236, 72, 153, 0.4)', // Pink 'rgba(59, 130, 246, 0.4)', // Blue 'rgba(255, 255, 255, 0.1)', // White ]; particles.push({ x: Math.random() * canvas.width, y: Math.random() * canvas.height, size: Math.random() * 2 + 1, // Smaller particles speedX: Math.random() * 0.5 - 0.25, // Slower movement speedY: Math.random() * 0.5 - 0.25, color: colors[Math.floor(Math.random() * colors.length)], opacity: Math.random() * 0.5 + 0.1, }); } function animate() { if (!ctx || !canvas) return; ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw connections - very subtle particles.forEach((particle, i) => { particles.slice(i + 1).forEach((otherParticle) => { const dx = particle.x - otherParticle.x; const dy = particle.y - otherParticle.y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance < 100) { ctx.beginPath(); ctx.strokeStyle = `rgba(255, 255, 255, ${0.05 * (1 - distance / 100)})`; ctx.lineWidth = 0.5; ctx.moveTo(particle.x, particle.y); ctx.lineTo(otherParticle.x, otherParticle.y); ctx.stroke(); } }); }); // Draw particles particles.forEach((particle) => { ctx.globalAlpha = particle.opacity; ctx.fillStyle = particle.color; ctx.beginPath(); ctx.arc(particle.x, particle.y, particle.size, 0, Math.PI * 2); ctx.fill(); // Update position particle.x += particle.speedX; particle.y += particle.speedY; if (particle.x < 0 || particle.x > canvas.width) particle.speedX *= -1; if (particle.y < 0 || particle.y > canvas.height) particle.speedY *= -1; }); requestAnimationFrame(animate); } animate(); const handleResize = () => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; }; window.addEventListener('resize', handleResize); return () => window.removeEventListener('resize', handleResize); }, []); return (
{/* Floating gradient orbs */}
{/* Morphing shapes */}
Scale your Social Media Presence

{typedText} |

Empower your brand with intelligent scheduling, deep analytics, and real-time engagement tools.

Start Free Trial Watch Demo
{stats.rating.toFixed(1)}/5
Rating
{(stats.users / 1000).toFixed(0)}K+
Active Users
{(stats.posts / 1000000).toFixed(1)}M+
Posts Scheduled
{/* Floating social media icons */}
📱
📊
💬
SocialBuddy Dashboard
📊 Analytics Overview
📅 Upcoming Posts
{/* Enhanced scroll indicator */}
Scroll
); }