'use client'; import { getGithubRepoInfo } from '@/lib/github'; import Link from 'next/link'; import { useEffect, useState } from 'react'; import { Button } from './ui/button'; function formatStars(stars: number) { if (stars >= 1000) { const k = stars / 1000; return `${k.toFixed(k >= 10 ? 0 : 1)}k`; } return stars.toString(); } export function GithubButton() { const [stars, setStars] = useState(3_700); useEffect(() => { getGithubRepoInfo().then((res) => { if (res?.stargazers_count) { setStars(res.stargazers_count); } }); }, []); return ( ); }