From 919a0bae689ea62f50c837ff0cc035bf4a48c4a7 Mon Sep 17 00:00:00 2001 From: Rafael Staib Date: Wed, 12 Aug 2026 21:31:08 +0000 Subject: [PATCH 1/5] github stars client-side fetch and caching --- .../platform/ecosystem/CommunityGrid.tsx | 15 +-- .../app/(content)/platform/ecosystem/Hero.tsx | 20 ++-- .../(content)/platform/ecosystem/StarPill.tsx | 17 ++- .../app/(content)/platform/ecosystem/page.tsx | 10 +- website/src/components/Header.tsx | 8 +- .../components/header/GitHubStarButton.tsx | 106 +----------------- website/src/helpers/githubStars.ts | 38 ------- website/src/helpers/useGitHubStarCount.ts | 101 +++++++++++++++++ 8 files changed, 132 insertions(+), 183 deletions(-) delete mode 100644 website/src/helpers/githubStars.ts create mode 100644 website/src/helpers/useGitHubStarCount.ts diff --git a/website/app/(content)/platform/ecosystem/CommunityGrid.tsx b/website/app/(content)/platform/ecosystem/CommunityGrid.tsx index c733480055b..9a24fe07da8 100644 --- a/website/app/(content)/platform/ecosystem/CommunityGrid.tsx +++ b/website/app/(content)/platform/ecosystem/CommunityGrid.tsx @@ -1,8 +1,8 @@ import type { ReactNode } from "react"; +import { GITHUB_REPO_URL, TOOLS } from "@/src/components/header/navData"; import { RevealOnScroll } from "@/src/components/RevealOnScroll"; import { SectionHeading } from "@/src/components/SectionHeading"; -import { GITHUB_REPO_URL, TOOLS } from "@/src/components/header/navData"; import { Card } from "@/src/design-system/Card"; import { BlogIcon } from "@/src/icons/Blog"; import { GitHubIcon } from "@/src/icons/GitHub"; @@ -58,10 +58,9 @@ const COMMUNITY_CARDS: readonly CommunityCardSpec[] = [ interface CommunityCardProps { readonly card: CommunityCardSpec; - readonly starCount: number | null; } -function CommunityCard({ card, starCount }: CommunityCardProps) { +function CommunityCard({ card }: CommunityCardProps) { const content = ( <>
@@ -73,7 +72,7 @@ function CommunityCard({ card, starCount }: CommunityCardProps) {

{card.body}

{card.withStars ? ( - + ) : ( {card.action} @@ -100,11 +99,7 @@ function CommunityCard({ card, starCount }: CommunityCardProps) { ); } -interface CommunityGridProps { - readonly starCount: number | null; -} - -export function CommunityGrid({ starCount }: CommunityGridProps) { +export function CommunityGrid() { return (
@@ -114,7 +109,7 @@ export function CommunityGrid({ starCount }: CommunityGridProps) { />
{COMMUNITY_CARDS.map((card) => ( - + ))}
diff --git a/website/app/(content)/platform/ecosystem/Hero.tsx b/website/app/(content)/platform/ecosystem/Hero.tsx index a14d4e90a28..893ee55c672 100644 --- a/website/app/(content)/platform/ecosystem/Hero.tsx +++ b/website/app/(content)/platform/ecosystem/Hero.tsx @@ -14,13 +14,13 @@ import { GitHubIcon } from "@/src/icons/GitHub"; import { SlackIcon } from "@/src/icons/Slack"; import { CARD_FOCUS_CLASSES } from "./cardFocus"; -import { PILL_CLASSES, StarPillContent } from "./StarPill"; import { CONNECTORS, ORBIT_RINGS, connectorPath, polarPoint, } from "./orbitGeometry"; +import { PILL_CLASSES, StarPillContent } from "./StarPill"; const RING_STROKE = "rgba(245,240,234,0.17)"; @@ -43,7 +43,7 @@ interface OrbitNodeSpec { readonly key: string; readonly angle: number; readonly radius: number; - readonly render: (starCount: number | null) => ReactNode; + readonly render: () => ReactNode; } const ORBIT_NODES: readonly OrbitNodeSpec[] = [ @@ -51,14 +51,14 @@ const ORBIT_NODES: readonly OrbitNodeSpec[] = [ key: "stars", angle: 197, radius: 680, - render: (starCount) => ( + render: () => ( - + ), }, @@ -203,11 +203,10 @@ function SocialChip({ href, label, children }: SocialChipProps) { } interface MobileHeroLinksProps { - readonly starCount: number | null; readonly contributors: ReadonlyArray | null; } -function MobileHeroLinks({ starCount, contributors }: MobileHeroLinksProps) { +function MobileHeroLinks({ contributors }: MobileHeroLinksProps) { const linkClassName = `border-cc-card-border bg-cc-surface text-cc-ink-dim flex min-h-11 items-center justify-center gap-2 rounded-lg border px-3 font-mono text-[0.65rem] no-underline ${CARD_FOCUS_CLASSES}`; return (