Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Remove NEXT_PUBLIC_DEMO environment variable and refactor TopBar component for dynamic signup link

Bill Yang0770b3ac769a
diff --git a/client/src/components/TopBar.tsx b/client/src/components/TopBar.tsx
index 9c290dbc3..909fc00ff 100644
--- a/client/src/components/TopBar.tsx
+++ b/client/src/components/TopBar.tsx
@@ -6,7 +6,6 @@ import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { authClient } from "../lib/auth";
-import { IS_DEMO } from "../lib/const";
import { Button } from "./ui/button";
import {
DropdownMenu,
@@ -70,14 +69,15 @@ export function TopBar() {
</DropdownMenu>
) : isPending ? (
<Skeleton className="w-20 h-4 mr-2" />
- ) : IS_DEMO ? (
- <Link href="https://app.rybbit.io/signup" passHref>
- <Button variant="ghost" size="xs">
- Sign up
- </Button>
- </Link>
) : (
- <Link href="/signup" passHref>
+ <Link
+ href={
+ globalThis.location.hostname === "demo.rybbit.io"
+ ? "https://app.rybbit.io/signup"
+ : "/signup"
+ }
+ passHref
+ >
<Button variant="ghost" size="xs">
Sign up
</Button>
diff --git a/client/src/lib/const.ts b/client/src/lib/const.ts
index 1b8447a47..7ce32a792 100644
--- a/client/src/lib/const.ts
+++ b/client/src/lib/const.ts
@@ -3,7 +3,6 @@ export const BACKEND_URL =
? "http://localhost:3001/api"
: `${process.env.NEXT_PUBLIC_BACKEND_URL}/api`;
export const IS_CLOUD = process.env.NEXT_PUBLIC_CLOUD === "true";
-export const IS_DEMO = process.env.NEXT_PUBLIC_DEMO === "true";
// Time constants
export const MINUTES_IN_24_HOURS = 24 * 60; // 1440 minutes
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 9049d54f4..3485a282e 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -108,7 +108,6 @@ services:
NEXT_PUBLIC_CLOUD: ${CLOUD}
environment:
- NODE_ENV=production
- - NEXT_PUBLIC_DEMO=true
- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
- NEXT_PUBLIC_DISABLE_SIGNUP=${DISABLE_SIGNUP}
- NEXT_PUBLIC_CLOUD=${CLOUD}