🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add AffiliateBanner to Header component
Bill Yang8dd8042bb5dc
diff --git a/client/src/app/[site]/components/Header/AffiliateBanner.tsx b/client/src/app/[site]/components/Header/AffiliateBanner.tsxnew file mode 100644index 000000000..d825580fc--- /dev/null+++ b/client/src/app/[site]/components/Header/AffiliateBanner.tsx@@ -0,0 +1,49 @@+"use client";++import { HandCoins, X } from "lucide-react";+import { useEffect, useState } from "react";+import { useAppEnv } from "../../../../hooks/useIsProduction";+import { IS_CLOUD } from "../../../../lib/const";++const STORAGE_KEY = "affiliate-banner-dismissed";++export function AffiliateBanner() {+ const [dismissed, setDismissed] = useState(true);++ const isProduction = useAppEnv() === "prod";++ useEffect(() => {+ setDismissed(localStorage.getItem(STORAGE_KEY) === "true");+ }, []);++ if (!IS_CLOUD || !isProduction || dismissed) return null;++ return (+ <div className="mt-4 px-4 py-3 rounded-lg border border-emerald-200 dark:border-emerald-400/30 bg-emerald-100/80 dark:bg-emerald-900/20 text-sm flex items-center justify-between">+ <div className="flex items-center gap-2">+ <HandCoins className="h-4 w-4 text-emerald-600 dark:text-emerald-400 shrink-0" />+ <span className="text-emerald-700 dark:text-emerald-300 font-medium">+ Earn <b>50%</b> recurring commission by referring Rybbit.{" "}+ <a+ href="https://rybbit.com/affiliate"+ target="_blank"+ rel="noopener noreferrer"+ className="underline hover:text-emerald-900 dark:hover:text-emerald-100"+ >+ Join our affiliate program+ </a>+ </span>+ </div>+ <button+ onClick={() => {+ localStorage.setItem(STORAGE_KEY, "true");+ setDismissed(true);+ }}+ className="ml-4 p-1 rounded hover:bg-emerald-200 dark:hover:bg-emerald-800/40 text-emerald-600 dark:text-emerald-400 transition-colors shrink-0 cursor-pointer"+ aria-label="Dismiss"+ >+ <X className="h-4 w-4" />+ </button>+ </div>+ );+}diff --git a/client/src/app/[site]/components/Header/Header.tsx b/client/src/app/[site]/components/Header/Header.tsxindex 1fffcc8f0..2fc5fe0ac 100644--- a/client/src/app/[site]/components/Header/Header.tsx+++ b/client/src/app/[site]/components/Header/Header.tsx@@ -3,6 +3,7 @@import { usePathname } from "next/navigation";import { FreePlanBanner } from "../../../../components/FreePlanBanner";import { userStore } from "../../../../lib/userStore";+import { AffiliateBanner } from "./AffiliateBanner";import { DemoSignupBanner } from "./DemoSignupBanner";import { NoData } from "./NoData";import { UsageBanners } from "./UsageBanners";@@ -16,6 +17,7 @@ export function Header() {{user && !pathname.includes("/globe") && (<div className="flex flex-col px-2 md:px-4"><DemoSignupBanner />+ <AffiliateBanner /><FreePlanBanner /><UsageBanners /><NoData />