'use client'; import { useEffect, useState } from 'react'; import { GithubOutlined } from '@ant-design/icons'; export default function GitHubStars() { const [stars, setStars] = useState(null); useEffect(() => { fetch('https://api.github.com/repos/mindverse/Second-Me') .then((res) => res.json()) .then((data) => { if (data.stargazers_count !== undefined) { setStars(data.stargazers_count); } }) .catch((err) => { console.error('Failed to fetch stars', err); }); }, []); const formatNumber = (_stars: number): string => { return _stars >= 1000 ? (_stars / 1000).toFixed(1) + 'k' : _stars.toString(); }; return (
{stars !== null ? formatNumber(stars) : 'Star On GitHub'}
); }