Skip to content

Commit

Permalink
restore github stars
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerwizard committed Dec 19, 2024
1 parent be35e4b commit 8475b9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions plugins/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ async function chHeader(context, opts) {

async loadContent() {
let github_stars = 38100;
// try {
// const githubData = await fetch(
// 'https://api.github.com/repos/ClickHouse/ClickHouse'
// )
// const data = await githubData.json()
// github_stars = data?.stargazers_count ?? github_stars
// } catch (error) {
// console.warn('Failed to fetch GitHub stars:', error)
// }
try {
const githubData = await fetch(
'https://api.github.com/repos/ClickHouse/ClickHouse'
)
const data = await githubData.json()
github_stars = data?.stargazers_count ?? github_stars
} catch (error) {
console.warn('Failed to fetch GitHub stars:', error)
}
return {
github_stars,
menuItems
Expand Down
4 changes: 2 additions & 2 deletions src/theme/Navbar/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export default function NavbarContent() {
const [secLeftItems, secRightItems] = splitNavbarItems(secondaryItems);

const {
github_stars,
github: { stars },
menuItems,
} = usePluginData("ch-header-plugin");

Expand Down Expand Up @@ -355,7 +355,7 @@ export default function NavbarContent() {
minimumFractionDigits: 1,
maximumFractionDigits: 1,
})
.format(38100)
.format(stars)
.toLowerCase()}
</span>
</div>
Expand Down

0 comments on commit 8475b9b

Please sign in to comment.