Skip to content

Commit 8abed07

Browse files
committed
improved star count presentation
1 parent 1120b31 commit 8abed07

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

website/src/pages/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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
247253
function 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>

0 commit comments

Comments
 (0)