Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions apps/web/src/providers/posthog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PostHogProvider as PostHogReactProvider } from "@posthog/react";
import posthog from "posthog-js";
import { useEffect, useRef, useState } from "react";
import { useEffect, useRef } from "react";

import { env } from "../env";

Expand All @@ -14,32 +14,27 @@ export function PostHogProvider({
enabled: boolean;
}) {
const didInitRef = useRef(false);
const [isInitialized, setIsInitialized] = useState(false);

useEffect(() => {
if (
typeof window === "undefined" ||
!enabled ||
!env.VITE_POSTHOG_API_KEY ||
isDev
isDev ||
didInitRef.current
) {
setIsInitialized(false);
return;
}

if (!didInitRef.current) {
posthog.init(env.VITE_POSTHOG_API_KEY, {
api_host: env.VITE_POSTHOG_HOST,
autocapture: true,
capture_pageview: true,
});
didInitRef.current = true;
}

setIsInitialized(true);
posthog.init(env.VITE_POSTHOG_API_KEY, {
api_host: env.VITE_POSTHOG_HOST,
autocapture: true,
capture_pageview: true,
});
didInitRef.current = true;
}, [enabled]);

if (!enabled || !env.VITE_POSTHOG_API_KEY || isDev || !isInitialized) {
if (!env.VITE_POSTHOG_API_KEY || isDev) {
return <>{children}</>;
}

Expand Down
7 changes: 7 additions & 0 deletions apps/web/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,55 @@
src: url("/fonts/Redaction-Regular.otf") format("opentype");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "Redaction";
src: url("/fonts/Redaction35-Regular.otf") format("opentype");
font-weight: 350;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "Redaction";
src: url("/fonts/Redaction70-Regular.otf") format("opentype");
font-weight: 700;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "SF Pro";
src: url("/fonts/SF-Pro-Text-Regular.otf") format("opentype");
font-weight: 400;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "SF Pro";
src: url("/fonts/SF-Pro-Text-Medium.otf") format("opentype");
font-weight: 500;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "SF Pro";
src: url("/fonts/SF-Pro-Text-Semibold.otf") format("opentype");
font-weight: 600;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: "SF Pro";
src: url("/fonts/SF-Pro-Text-Bold.otf") format("opentype");
font-weight: 700;
font-style: normal;
font-display: swap;
}

@import "tailwindcss";
Expand Down
Loading