import staticContent from '.generated/staticContent/_index.json' import { useSendTelemetryEvent } from '~/lib/telemetry' import { Button } from 'ui' export 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 GitHubButton = () => { const sendTelemetryEvent = useSendTelemetryEvent() const githubStars = staticContent.githubStars return ( ) } export default GitHubButton