11import { Logo } from '@/components/logo'
2+ import { StarBadge } from '@/components/star-badge'
23
34type Product = {
45 key : string
@@ -63,7 +64,8 @@ const products: Product[] = [
6364 } ,
6465]
6566
66- // Fetch star counts at build time (static export). Fails soft: on any error the
67+ // Fetch star counts at build time (static export), used only as a fallback
68+ // when the client-side fetch in StarBadge fails. Fails soft: on any error the
6769// badge simply links to the repo without a count instead of breaking the build.
6870async function getStars ( repo : string ) : Promise < number | null > {
6971 try {
@@ -79,11 +81,6 @@ async function getStars(repo: string): Promise<number | null> {
7981 }
8082}
8183
82- function formatStars ( n : number ) : string {
83- if ( n >= 1000 ) return `${ ( n / 1000 ) . toFixed ( 1 ) . replace ( / \. 0 $ / , '' ) } k`
84- return String ( n )
85- }
86-
8784// Conic blend of the four brand colours, rotated so each lands on its card's
8885// corner: red (pgschema) top-right, orange (pgparser) bottom-right, green
8986// (pgtui) bottom-left, blue (pgconsole) top-left; red repeats to close the loop.
@@ -157,26 +154,7 @@ export default async function Page() {
157154 alt = ""
158155 className = "h-auto w-20 shrink-0 transition-transform duration-200 group-hover:-translate-y-0.5 sm:w-28"
159156 />
160- < a
161- href = { `https://github.com/${ prod . repo } ` }
162- target = "_blank"
163- rel = "noreferrer"
164- aria-label = { `${ prod . name } on GitHub${
165- starCount !== null ? `, ${ starCount } stars` : ''
166- } `}
167- className = "pointer-events-auto relative z-10 inline-flex items-center gap-2 rounded-full border border-border px-3.5 py-1.5 text-sm font-medium tabular-nums text-ink-dim transition-colors hover:border-ink-dim hover:text-ink sm:px-4 sm:py-2 sm:text-base"
168- >
169- < svg
170- width = "18"
171- height = "18"
172- viewBox = "0 0 24 24"
173- fill = "currentColor"
174- aria-hidden = "true"
175- >
176- < path d = "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
177- </ svg >
178- { starCount !== null && < span > { formatStars ( starCount ) } </ span > }
179- </ a >
157+ < StarBadge repo = { prod . repo } name = { prod . name } fallback = { starCount } />
180158 </ div >
181159
182160 { /* bottom: name + tagline + cta */ }
0 commit comments