File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,12 @@ function StarIcon() {
243243 ) ;
244244}
245245
246+ function formatStarCount ( count : number ) : string {
247+ if ( count < 1000 ) return count . toString ( ) ;
248+ const formatted = ( count / 1000 ) . toFixed ( 1 ) ;
249+ return formatted . replace ( / \. 0 $ / , '' ) + 'k' ;
250+ }
251+
246252// Hook to fetch GitHub stars with caching
247253function useGitHubStars ( repo : string ) : number | null {
248254 const [ stars , setStars ] = useState < number | null > ( ( ) => {
@@ -317,7 +323,7 @@ function SocialProofBar() {
317323 { courseStars !== null && (
318324 < >
319325 { ' ' }
320- < StarIcon /> { courseStars }
326+ < StarIcon /> { formatStarCount ( courseStars ) }
321327 </ >
322328 ) }
323329 </ a >
@@ -332,7 +338,7 @@ function SocialProofBar() {
332338 { chunkHoundStars !== null && (
333339 < >
334340 { ' ' }
335- < StarIcon /> { chunkHoundStars }
341+ < StarIcon /> { formatStarCount ( chunkHoundStars ) }
336342 </ >
337343 ) }
338344 </ a >
@@ -347,7 +353,7 @@ function SocialProofBar() {
347353 { arguSeekStars !== null && (
348354 < >
349355 { ' ' }
350- < StarIcon /> { arguSeekStars }
356+ < StarIcon /> { formatStarCount ( arguSeekStars ) }
351357 </ >
352358 ) }
353359 </ a >
You can’t perform that action at this time.
0 commit comments