import { useEffect, useState } from "react"; import { motion } from "framer-motion"; import { Users, Wrench, Star } from "lucide-react"; interface Stat { label: string; value: string; icon: React.ElementType; } export function StatsSection() { const [stats, setStats] = useState([ { label: "Active Users", value: "Loading...", icon: Users }, { label: "Security Tools", value: "Loading...", icon: Wrench }, { label: "GitHub Stars", value: "Loading...", icon: Star }, ]); const [error, setError] = useState(false); const fetchGitHubStats = async (username: string) => { try { const response = await fetch(`https://api.github.com/users/${username}`); const userData = await response.json(); const reposResponse = await fetch(userData.repos_url); const reposData = await reposResponse.json(); const starsCount = reposData.reduce((acc: number, repo: any) => acc + repo.stargazers_count, 0); setStats([ { label: "Followers", value: `${userData.followers}`, icon: Users }, { label: "Repositories", value: `${reposData.length}`, icon: Wrench }, { label: "Stars", value: `${starsCount}`, icon: Star }, ]); } catch (error) { console.error("Error fetching GitHub data:", error); setError(true); } }; useEffect(() => { const username = "Snigdha-OS"; // Replace with the desired GitHub username fetchGitHubStats(username); }, []); return (

Our Impact

A snapshot of our growing community and contributions.

{error ? (
Unable to fetch data. Please try again later.
) : (
{stats.map((stat, index) => ( {stat.value}

{stat.label}

))}
)}
); }