Skip to content

Commit

Permalink
Merge pull request #2932 from ClickHouse/fixstars
Browse files Browse the repository at this point in the history
fix stars?
  • Loading branch information
gingerwizard authored Dec 19, 2024
2 parents 8e4050a + e8b3138 commit bf59451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions plugins/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@ async function chHeader(context, opts) {
name: 'ch-header-plugin',

async loadContent() {
let stars = 38000;
let github_stars = 38100;
try {
const githubData = await fetch(
'https://api.github.com/repos/ClickHouse/ClickHouse'
)
const data = await githubData.json()
stars = data?.stargazers_count ?? stars
github_stars = data?.stargazers_count ?? github_stars
} catch (error) {
console.warn('Failed to fetch GitHub stars:', error)
}
return {
github: {
stars
},
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(stars)
.format(github_stars)
.toLowerCase()}
</span>
</div>
Expand Down

0 comments on commit bf59451

Please sign in to comment.