Skip to content

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

whitelabel stuff (#767)

Bill Yang03d725e53be4
diff --git a/client/public/ruby.png b/client/public/ruby.png
new file mode 100644
index 000000000..84269f9e5
Binary files /dev/null and b/client/public/ruby.png differ
diff --git a/client/src/app/[site]/main/components/MainSection/MainSection.tsx b/client/src/app/[site]/main/components/MainSection/MainSection.tsx
index 0c886e9e7..3aa6547ca 100644
--- a/client/src/app/[site]/main/components/MainSection/MainSection.tsx
+++ b/client/src/app/[site]/main/components/MainSection/MainSection.tsx
@@ -7,6 +7,7 @@ import { useGetOverview } from "../../../../../api/analytics/hooks/useGetOvervie
import { useGetOverviewBucketed } from "../../../../../api/analytics/hooks/useGetOverviewBucketed";
import { BucketSelection } from "../../../../../components/BucketSelection";
import { RybbitLogo } from "../../../../../components/RybbitLogo";
+import { useWhiteLabel } from "../../../../../hooks/useIsWhiteLabel";
import { authClient } from "../../../../../lib/auth";
import { useStore } from "../../../../../lib/store";
import { cn } from "../../../../../lib/utils";
@@ -32,6 +33,7 @@ const tilt_wrap = Tilt_Warp({
});
export function MainSection() {
+ const { isWhiteLabel } = useWhiteLabel();
const session = authClient.useSession();
const { selectedStat, time, site, bucket, showUsersSplit, setShowUsersSplit } = useStore();
@@ -84,9 +86,9 @@ export function MainSection() {
<Card className="overflow-visible">
{(isFetching || isPreviousFetching) && <CardLoader />}
<CardContent className="p-2 md:p-4 py-3 w-full">
- <div className="flex gap-2 justify-between items-center px-2 md:px-0 relative">
- <div className="flex items-center justify-between">
- <div className="flex items-center space-x-4">
+ <div className="flex items-center justify-between px-2 md:px-0">
+ <div className="flex items-center space-x-4">
+ {!isWhiteLabel && (
<Link
href={session.data ? "/" : "https://rybbit.com"}
className={cn("text-lg font-semibold flex items-center gap-1.5 opacity-75", tilt_wrap.className)}
@@ -94,7 +96,7 @@ export function MainSection() {
<RybbitLogo width={20} height={20} />
rybbit
</Link>
- </div>
+ )}
</div>
<span className="text-sm text-neutral-700 dark:text-neutral-200">{SELECTED_STAT_MAP[selectedStat]}</span>
<div className="flex items-center">
diff --git a/client/src/app/[site]/performance/components/PerformanceChart.tsx b/client/src/app/[site]/performance/components/PerformanceChart.tsx
index 19402629f..cbc6bc0f5 100644
--- a/client/src/app/[site]/performance/components/PerformanceChart.tsx
+++ b/client/src/app/[site]/performance/components/PerformanceChart.tsx
@@ -18,6 +18,7 @@ import { cn } from "../../../../lib/utils";
import { usePerformanceStore } from "../performanceStore";
import { formatMetricValue, getMetricUnit, getPerformanceThresholds, METRIC_LABELS } from "../utils/performanceUtils";
import { ChartTooltip } from "../../../../components/charts/ChartTooltip";
+import { useWhiteLabel } from "../../../../hooks/useIsWhiteLabel";
const tilt_wrap = Tilt_Warp({
subsets: ["latin"],
@@ -29,6 +30,7 @@ export function PerformanceChart() {
const { site, bucket } = useStore();
const { selectedPerformanceMetric, selectedPercentile } = usePerformanceStore();
const nivoTheme = useNivoTheme();
+ const { isWhiteLabel } = useWhiteLabel();
// State for toggling percentile visibility
const [visiblePercentiles, setVisiblePercentiles] = useState<Set<string>>(new Set(["P50", "P75", "P90", "P99"]));
diff --git a/client/src/app/components/Footer.tsx b/client/src/app/components/Footer.tsx
index 60b5d78a2..9f9ae42e5 100644
--- a/client/src/app/components/Footer.tsx
+++ b/client/src/app/components/Footer.tsx
@@ -1,8 +1,13 @@
import Link from "next/link";
import { IS_CLOUD } from "../../lib/const";
+import { useWhiteLabel } from "../../hooks/useIsWhiteLabel";
export function Footer() {
const APP_VERSION = process.env.NEXT_PUBLIC_APP_VERSION;
+ const { isWhiteLabel } = useWhiteLabel();
+ if (isWhiteLabel) {
+ return null;
+ }
return (
<div className="flex justify-center items-center h-12 text-neutral-400 gap-4 text-xs">
diff --git a/client/src/components/RybbitLogo.tsx b/client/src/components/RybbitLogo.tsx
index ba46371a1..64890082a 100644
--- a/client/src/components/RybbitLogo.tsx
+++ b/client/src/components/RybbitLogo.tsx
@@ -1,9 +1,46 @@
import Image from "next/image";
+import { useWhiteLabel } from "../hooks/useIsWhiteLabel";
+import { Skeleton } from "./ui/skeleton";
export function RybbitLogo({ width = 32, height = 32 }: { width?: number; height?: number }) {
- return <Image src="/rybbit.svg" alt="Rybbit" width={width} height={height} className="invert dark:invert-0" />;
+ const { whiteLabelImage, isPending } = useWhiteLabel();
+
+ if (isPending) {
+ return <Skeleton style={{ width, height }} />;
+ }
+
+ if (whiteLabelImage) {
+ return <Image src={whiteLabelImage} alt="Rybbit" width={width} height={height} />;
+ }
+
+ return (
+ <Image
+ src={whiteLabelImage || "/rybbit.svg"}
+ alt="Rybbit"
+ width={width}
+ height={height}
+ className="invert dark:invert-0"
+ />
+ );
}
export function RybbitTextLogo({ width = 150, height = 34 }: { width?: number; height?: number }) {
- return <Image src="/rybbit-text.svg" alt="Rybbit" width={width} height={height} className="dark:invert-0 invert" />;
+ const { whiteLabelImage, isPending } = useWhiteLabel();
+ if (isPending) {
+ return <Skeleton style={{ width, height }} />;
+ }
+
+ if (whiteLabelImage) {
+ return <Image src={whiteLabelImage} alt="Rybbit" width={width} height={height} />;
+ }
+
+ return (
+ <Image
+ src={whiteLabelImage || "/rybbit-text.svg"}
+ alt="Rybbit"
+ width={width}
+ height={height}
+ className="dark:invert-0 invert"
+ />
+ );
}
diff --git a/client/src/hooks/useIsWhiteLabel.ts b/client/src/hooks/useIsWhiteLabel.ts
new file mode 100644
index 000000000..8b99f7a48
--- /dev/null
+++ b/client/src/hooks/useIsWhiteLabel.ts
@@ -0,0 +1,12 @@
+import { authClient } from "../lib/auth";
+
+const WHITE_LABEL_ORGANIZATIONS: Record<string, string> = { XQroMSqHm87DPcvFozpajPI7ufVdxta6: "/ruby.png" };
+
+export function useWhiteLabel() {
+ const { data: activeOrganization, isPending } = authClient.useActiveOrganization();
+ return {
+ isWhiteLabel: !!WHITE_LABEL_ORGANIZATIONS[activeOrganization?.id || ""],
+ whiteLabelImage: WHITE_LABEL_ORGANIZATIONS[activeOrganization?.id || ""],
+ isPending,
+ };
+}