fix: github star count

This commit is contained in:
Nik L
2026-04-14 12:11:18 -04:00
parent f4fa328455
commit 3f7a5e0fc1
2 changed files with 22 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
'use client'
import { PlatformProvider } from '@/components/platform-toggle'
import { Nav } from '@/components/nav'
import { Hero } from '@/components/hero'

View File

@@ -1,15 +1,28 @@
'use client'
import { BetaSignup } from './beta-signup'
const badges = [
{ href: 'https://github.com/GreyhavenHQ/greywall', label: 'GitHub', value: '138 stars' },
{ href: 'https://github.com/GreyhavenHQ/greywall/blob/main/LICENSE', label: 'License', value: 'Apache-2.0' },
{ href: 'https://github.com/GreyhavenHQ/greywall/releases', label: 'Release', value: 'v0.3.1' },
{ href: 'https://github.com/GreyhavenHQ/greywall', label: 'Go', value: 'v1.25' },
{ href: 'https://www.producthunt.com/products/greywall?launch=greywall', label: 'Product Hunt', value: 'Greywall' },
]
async function getStarCount(): Promise<string> {
try {
const res = await fetch('https://api.github.com/repos/GreyhavenHQ/greywall', {
next: { revalidate: 3600 },
headers: { Accept: 'application/vnd.github+json' },
})
if (!res.ok) return '138 stars'
const data = await res.json()
return typeof data.stargazers_count === 'number' ? `${data.stargazers_count} stars` : '138 stars'
} catch {
return '138 stars'
}
}
export function Hero() {
export async function Hero() {
const stars = await getStarCount()
const badges = [
{ href: 'https://github.com/GreyhavenHQ/greywall', label: 'GitHub', value: stars },
{ href: 'https://github.com/GreyhavenHQ/greywall/blob/main/LICENSE', label: 'License', value: 'Apache-2.0' },
{ href: 'https://github.com/GreyhavenHQ/greywall/releases', label: 'Release', value: 'v0.3.1' },
{ href: 'https://github.com/GreyhavenHQ/greywall', label: 'Go', value: 'v1.25' },
{ href: 'https://www.producthunt.com/products/greywall?launch=greywall', label: 'Product Hunt', value: 'Greywall' },
]
return (
<section className="relative w-full px-4 pt-8 pb-6 sm:px-6 sm:pt-10 sm:pb-8">
<div className="relative z-10 mx-auto max-w-5xl text-center">