🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update Product Hunt badge and enhance GitHub star display in header
Bill Yangedb6e5ac8793
diff --git a/docs/src/app/(home)/page.tsx b/docs/src/app/(home)/page.tsxindex eca4377ef..67fb5e7b0 100644--- a/docs/src/app/(home)/page.tsx+++ b/docs/src/app/(home)/page.tsx@@ -92,15 +92,14 @@ export default function HomePage() {<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(faqSchema) }} /><div className="flex flex-col items-center justify-center overflow-x-hidden pt-16 md:pt-24">{/* <GitHubStarButton /> */}-<a- href="https://www.producthunt.com/products/rybbit?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-rybbit-2"+ href="https://www.producthunt.com/products/rybbit?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_source=badge-rybbit-2"target="_blank"><img- src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1028220&theme=light&t=1760858602053"+ src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=1028220&theme=neutral&period=daily&t=1761001525479"alt="Rybbit - Open Source Google Analytics Replacement | Product Hunt"- style={{ width: "250px", height: "54px", marginBottom: "40px" }}+ style={{ width: "210px", height: "54px", marginBottom: "35px" }}width="250"height="54"/>diff --git a/docs/src/components/CustomHeader.tsx b/docs/src/components/CustomHeader.tsxindex ab4cdf172..f85f1dbb5 100644--- a/docs/src/components/CustomHeader.tsx+++ b/docs/src/components/CustomHeader.tsx@@ -6,13 +6,16 @@ import { useState } from "react";import { Menu, X } from "lucide-react";import { trackAdEvent } from "@/lib/trackAdEvent";import { Banner } from "fumadocs-ui/components/banner";+import { useGithubStarCount } from "../lib/useGithubStarCount";export function CustomHeader() {+ const { starCount, isLoading } = useGithubStarCount();+const [mobileMenuOpen, setMobileMenuOpen] = useState(false);return (<header className="sticky top-0 z-50 w-full border-b border-neutral-800 bg-background/80 backdrop-blur-md">- <Banner id="banner" changeLayout height="45px" variant="rainbow">+ {/* <Banner id="banner" changeLayout height="45px" variant="rainbow"><div className="flex items-center justify-center"><p className="text-sm font-medium">Rybbit is launching on Product Hunt today!{" "}@@ -26,7 +29,7 @@ export function CustomHeader() {</a></p></div>- </Banner>+ </Banner> */}<nav className="mx-auto flex max-w-7xl items-center justify-between px-4 py-3" aria-label="Global">{/* Logo */}<div className="flex items-center">@@ -66,7 +69,7 @@ export function CustomHeader() {href="https://discord.gg/DEhGb4hYBj"target="_blank"rel="noopener noreferrer"- className="text-neutral-400 hover:text-white transition-colors"+ className="text-neutral-200 hover:text-white transition-colors"aria-label="Discord"><svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">@@ -79,13 +82,24 @@ export function CustomHeader() {href="https://github.com/rybbit-io/rybbit"target="_blank"rel="noopener noreferrer"- className="text-neutral-400 hover:text-white transition-colors"+ className="text-neutral-200 hover:text-white transition-colors"aria-label="GitHub"onClick={() => trackAdEvent("github", { location: "header" })}>- <svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">- <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />- </svg>+ <div className="flex items-center gap-2">+ <svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">+ <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />+ </svg>+ {isLoading ? (+ <div className="w-14 h-6 bg-neutral-800 rounded-full animate-pulse"></div>+ ) : (+ starCount && (+ <div className="w-14 text-sm p-1 px-2 bg-neutral-800 rounded-full hover:bg-neutral-700 transition-colors">+ {starCount}+ </div>+ )+ )}+ </div></a>{/* Login Button */}@@ -155,6 +169,7 @@ export function CustomHeader() {>GitHub</a>+<div className="pt-2 border-t border-neutral-800"><a href="https://app.rybbit.io" target="_blank" rel="noopener noreferrer" className="block w-full"><buttondiff --git a/docs/src/components/Footer.tsx b/docs/src/components/Footer.tsxindex c110a3bfd..94b301647 100644--- a/docs/src/components/Footer.tsx+++ b/docs/src/components/Footer.tsx@@ -14,23 +14,21 @@ export function Footer() {Open source, privacy-focused web analytics platform that respectsuser privacy.</p> */}- {/* ProductHunt Badge */}- <div className="mt-4">+ {/* <div className="mt-4"><ahref="https://www.producthunt.com/products/rybbit?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_source=badge-rybbit"target="_blank"rel="noopener noreferrer">- {/* eslint-disable-next-line @next/next/no-img-element */}<img- src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=981885&theme=dark&period=daily&t=1751440591330"+ src="https://api.producthunt.com/widgets/embed-image/v1/top-post-badge.svg?post_id=1028220&theme=dark&period=daily&t=1761000444319"alt="Rybbit - The open source Google Analytics replacement | Product Hunt"style={{ width: "200px", height: "43px" }}width="200"height="43"/></a>- </div>+ </div> */}{/* Social Media Links */}<div className="flex gap-4"><adiff --git a/docs/src/components/GitHubStarButton.tsx b/docs/src/components/GitHubStarButton.tsxindex a6e3301d8..d9d98adfa 100644--- a/docs/src/components/GitHubStarButton.tsx+++ b/docs/src/components/GitHubStarButton.tsx@@ -1,32 +1,11 @@"use client";-import { useState, useEffect } from "react";import { Star } from "lucide-react";import { trackAdEvent } from "../lib/trackAdEvent";+import { useGithubStarCount } from "../lib/useGithubStarCount";export function GitHubStarButton() {- const [starCount, setStarCount] = useState<string | null>(null);- const [isLoading, setIsLoading] = useState(true);-- useEffect(() => {- const fetchStarCount = async () => {- try {- const response = await fetch("https://api.github.com/repos/rybbit-io/rybbit");- const data = await response.json();-- if (data.stargazers_count) {- setStarCount(data.stargazers_count.toLocaleString());- }- } catch (error) {- console.log("Could not fetch GitHub stars:", error);- setStarCount(null); // Explicitly set to null on error- } finally {- setIsLoading(false);- }- };-- fetchStarCount();- }, []);+ const { starCount, isLoading } = useGithubStarCount();return (<div className="mb-6 md:mb-8" onClick={() => trackAdEvent("github")}>diff --git a/docs/src/lib/useGithubStarCount.ts b/docs/src/lib/useGithubStarCount.tsnew file mode 100644index 000000000..bf507c597--- /dev/null+++ b/docs/src/lib/useGithubStarCount.ts@@ -0,0 +1,28 @@+import { useEffect, useState } from "react";++export function useGithubStarCount() {+ const [starCount, setStarCount] = useState<string | null>(null);+ const [isLoading, setIsLoading] = useState(true);++ useEffect(() => {+ const fetchStarCount = async () => {+ try {+ const response = await fetch("https://api.github.com/repos/rybbit-io/rybbit");+ const data = await response.json();++ if (data.stargazers_count) {+ setStarCount(data.stargazers_count.toLocaleString());+ }+ } catch (error) {+ console.log("Could not fetch GitHub stars:", error);+ setStarCount(null); // Explicitly set to null on error+ } finally {+ setIsLoading(false);+ }+ };++ fetchStarCount();+ }, []);++ return { starCount, isLoading };+}