"use client"; import { useEffect, useState } from "react"; import { CiStar } from "react-icons/ci"; import { FaGithub } from "react-icons/fa"; import StarIcon from "../../assets/imgs/star.svg"; export default function ({ owner, repo, interval = 6000, }: { owner: string; repo: string; interval: number; }) { const [stars, setStars] = useState(0); const fetchStars = async () => { try { const response = await fetch( `https://api.github.com/repos/${owner}/${repo}` ); const data = await response.json(); setStars(data.stargazers_count); } catch (error) { console.error("Error fetching star count:", error); } }; useEffect(() => { fetchStars(); const intervalId = setInterval(fetchStars, interval); return () => clearInterval(intervalId); }, [owner, repo, interval]); return (
Open-Source( star {stars})
chatmcp/mcp-directory
); }