-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8704883
commit 0467aee
Showing
2 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
export function GithubStars() { | ||
const [stars, setStars] = useState(null); | ||
|
||
useEffect(() => { | ||
async function fetchStars() { | ||
const response = await fetch('https://api.github.com/repos/AgentOps-AI/agentops'); | ||
const data = await response.json(); | ||
const stars = Math.ceil(data.stargazers_count / 1000) * 1000; | ||
setStars(stars.toLocaleString()); | ||
} | ||
fetchStars(); | ||
}, []); | ||
|
||
return <p>{stars ? `${stars}th` : '2,000th'}</p>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters