import { Button } from 'ui' import staticContent from '~/.contentlayer/generated/staticContent/_index.json' with { type: 'json' } import { useSendTelemetryEvent } from '~/lib/telemetry' const { githubStars } = staticContent const GitHubButton = () => { const kFormatter = (num: number) => { const kFormat = Math.floor(num / 1000) const lastTwoDigits = num % 1000 const decimalPart = Math.floor((lastTwoDigits % 100) / 10) const hundreds = Math.floor(lastTwoDigits / 100) const isAlmostNextThousand = decimalPart >= 8 && hundreds >= 9 const showDecimals = (!isAlmostNextThousand && hundreds >= 1) || (hundreds === 0 && decimalPart >= 8) return showDecimals ? `${kFormat}.${decimalPart >= 8 ? hundreds + 1 : hundreds}K` : `${isAlmostNextThousand ? kFormat + 1 : kFormat}K` } const sendTelemetryEvent = useSendTelemetryEvent() return ( ) } export default GitHubButton