From 5695b3d6aa72f6023f4131c55acd0293dc7c5c6f Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Fri, 13 Mar 2026 20:23:13 +0800 Subject: [PATCH] chore(website): add social media link; add star --- README.md | 2 +- docs/README-zh.md | 2 +- packages/website/src/components/Footer.tsx | 19 +++++++++++++- packages/website/src/components/Header.tsx | 23 +++++++++++++---- packages/website/src/hooks/useGitHubStars.ts | 27 ++++++++++++++++++++ 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 packages/website/src/hooks/useGitHubStars.ts diff --git a/README.md b/README.md index c220159..b24f131 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The GUI Agent Living in Your Webpage. Control web interfaces with natural langua 🌐 **English** | [δΈ­ζ–‡](./docs/README-zh.md) -πŸ‘‰ πŸš€ Demo | πŸ“– Documentation | πŸ“’ Join HN Discussion +πŸ‘‰ πŸš€ Demo | πŸ“– Documentation | πŸ“’ Join HN Discussion | 𝕏 Follow on X diff --git a/docs/README-zh.md b/docs/README-zh.md index 07edc12..44c0c65 100644 --- a/docs/README-zh.md +++ b/docs/README-zh.md @@ -11,7 +11,7 @@ 🌐 [English](../README.md) | **δΈ­ζ–‡** -πŸ‘‰ πŸš€ Demo | πŸ“– Documentation | πŸ“’ Join HN Discussion +πŸ‘‰ πŸš€ Demo | πŸ“– Documentation | πŸ“’ Join HN Discussion | 𝕏 Follow on X diff --git a/packages/website/src/components/Footer.tsx b/packages/website/src/components/Footer.tsx index ae2dc15..9cedb03 100644 --- a/packages/website/src/components/Footer.tsx +++ b/packages/website/src/components/Footer.tsx @@ -1,4 +1,4 @@ -import { siGithub } from 'simple-icons' +import { siGithub, siX } from 'simple-icons' import { useLanguage } from '@/i18n/context' @@ -15,6 +15,7 @@ export default function Footer() {

Β© 2026 page-agent. All rights reserved.

+
{isZh ? 'δ½Ώη”¨ζ‘ζ¬ΎδΈŽιšη§' : 'Terms & Privacy'} + + + @@ -34,8 +36,11 @@ export default function Header() { className="w-10 h-10 rounded-xl group-hover:scale-110 transition-transform duration-200" />
- + page-agent + + {import.meta.env.VERSION} + + {stars !== null && ( + β˜… {formatStars(stars)} + )} @@ -86,9 +94,6 @@ export default function Header() { role="navigation" aria-label={isZh ? 'ζ–‡ζ‘£' : 'Docs'} > - - {import.meta.env.VERSION} - GitHub + {stars !== null && ( + β˜… {formatStars(stars)} + )} @@ -161,6 +169,11 @@ export default function Header() { GitHub + {stars !== null && ( + + β˜… {formatStars(stars)} + + )}
diff --git a/packages/website/src/hooks/useGitHubStars.ts b/packages/website/src/hooks/useGitHubStars.ts new file mode 100644 index 0000000..8b68e60 --- /dev/null +++ b/packages/website/src/hooks/useGitHubStars.ts @@ -0,0 +1,27 @@ +import { useEffect, useState } from 'react' + +const STATS_URL = 'https://page-agent.github.io/gh-stats/stats.json' + +let cached: number | null = null + +export function useGitHubStars() { + const [stars, setStars] = useState(cached) + + useEffect(() => { + if (cached !== null) return + fetch(STATS_URL) + .then((r) => r.json()) + .then((data) => { + cached = data.stargazers_count ?? null + setStars(cached) + }) + .catch(() => {}) + }, []) + + return stars +} + +export function formatStars(n: number): string { + if (n >= 1000) return `${(n / 1000).toFixed(1).replace(/\.0$/, '')}k` + return String(n) +}