From aaf6a241655c19586835a346da4aab66cd71bcc1 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Sun, 1 Mar 2026 19:07:20 -0800 Subject: [PATCH] Show GitHub star badge in mobile header (#735) Removed the `hidden md:flex` wrapper so the GitHubStarsBadge renders on all screen sizes. Made the component reusable with optional `location` and `className` props. Replaced the plain "GitHub" text link in the mobile drawer with the star badge component. --- web/app/components/github-stars.tsx | 34 +++++++++++++++++++---------- web/app/components/site-header.tsx | 15 ++----------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/web/app/components/github-stars.tsx b/web/app/components/github-stars.tsx index 1dc3adb4..45b2d626 100644 --- a/web/app/components/github-stars.tsx +++ b/web/app/components/github-stars.tsx @@ -11,7 +11,25 @@ function formatStars(count: number): string { return String(count); } -export function GitHubStarsBadge() { +const GITHUB_ICON = ( + + + +); + +export function GitHubStarsBadge({ + location = "stars_badge", + className, +}: { + location?: string; + className?: string; +} = {}) { const [stars, setStars] = useState(null); useEffect(() => { @@ -31,19 +49,11 @@ export function GitHubStarsBadge() { target="_blank" rel="noopener noreferrer" onClick={() => - posthog.capture("cmuxterm_github_clicked", { location: "stars_badge" }) + posthog.capture("cmuxterm_github_clicked", { location }) } - className="inline-flex items-center gap-1.5 pr-1 text-sm text-muted hover:text-foreground transition-colors animate-fade-in" + className={className ?? "inline-flex items-center gap-1.5 pr-1 text-sm text-muted hover:text-foreground transition-colors animate-fade-in"} > - - - + {GITHUB_ICON} {formatStars(stars)} ); diff --git a/web/app/components/site-header.tsx b/web/app/components/site-header.tsx index 81742b99..bc868280 100644 --- a/web/app/components/site-header.tsx +++ b/web/app/components/site-header.tsx @@ -1,7 +1,6 @@ "use client"; import Link from "next/link"; -import posthog from "posthog-js"; import { NavLinks } from "./nav-links"; import { DownloadButton } from "./download-button"; import { ThemeToggle } from "../theme"; @@ -58,9 +57,7 @@ export function SiteHeader({ {/* Right: GitHub stars + Download + theme + mobile */} - - - + @@ -137,15 +134,7 @@ export function SiteHeader({ > Community - posthog.capture("cmuxterm_github_clicked", { location: "mobile_drawer" })} - className="hover:text-foreground transition-colors py-1" - > - GitHub - +