'use client'; import { Github } from 'lucide-react'; import Image from 'next/image'; import { useEffect, useState } from 'react'; import { GITHUB_REPO } from '@/lib/constants'; function formatStarCount(count: number): string { if (count >= 1000) { const k = count / 1000; return k % 1 === 0 ? `${k}k` : `${k.toFixed(1)}k`; } return count.toString(); } export function Navbar() { const [starCount, setStarCount] = useState(null); useEffect(() => { fetch('/api/stars') .then((res) => { if (!res.ok) throw new Error('Failed to fetch stars'); return res.json(); }) .then((data) => { if (typeof data.count === 'number') setStarCount(data.count); }) .catch((error) => { console.error('Failed to fetch star count:', error); }); }, []); return ( ); }