Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
📈 Track theme (#2092)
Luke Vella712d415235ee
diff --git a/apps/web/src/app/[locale]/layout.tsx b/apps/web/src/app/[locale]/layout.tsxindex db43ef09b..3c0bac48b 100644--- a/apps/web/src/app/[locale]/layout.tsx+++ b/apps/web/src/app/[locale]/layout.tsx@@ -1,6 +1,6 @@import "./globals.css";-import { PostHogIdentify, PostHogProvider } from "@rallly/posthog/client";+import { PostHogProvider } from "@rallly/posthog/client";import { Toaster } from "@rallly/ui/sonner";import { ThemeProvider } from "@rallly/ui/theme-provider";import { TooltipProvider } from "@rallly/ui/tooltip";@@ -9,7 +9,6 @@ import type { Metadata, Viewport } from "next";import { Inter } from "next/font/google";import { PublicEnvScript } from "next-runtime-env";import type React from "react";-import { TimeZoneChangeDetector } from "@/app/[locale]/timezone-change-detector";import type { Params } from "@/app/[locale]/types";import { requireUser } from "@/auth/data";@@ -27,6 +26,7 @@ import { TRPCProvider } from "@/trpc/client/provider";import { getForegroundColor } from "@/utils/color";import { ConnectedDayjsProvider } from "@/utils/dayjs";import { PostHogPageView } from "../posthog-page-view";+import { PostHogIdentify } from "./posthog-identify";const inter = Inter({subsets: ["latin"],diff --git a/apps/web/src/app/[locale]/posthog-identify.tsx b/apps/web/src/app/[locale]/posthog-identify.tsxnew file mode 100644index 000000000..429df46ac--- /dev/null+++ b/apps/web/src/app/[locale]/posthog-identify.tsx@@ -0,0 +1,18 @@+"use client";+import { usePostHog } from "@rallly/posthog/client";+import { useTheme } from "@rallly/ui/theme-provider";+import useMount from "react-use/lib/useMount";++export function PostHogIdentify({ distinctId }: { distinctId?: string }) {+ const posthog = usePostHog();+ const { theme } = useTheme();+ useMount(() => {+ if (posthog && distinctId) {+ posthog.identify(distinctId, {+ theme,+ });+ }+ });++ return null;+}diff --git a/packages/posthog/src/client.tsx b/packages/posthog/src/client.tsxindex 9215b0892..862a24767 100644--- a/packages/posthog/src/client.tsx+++ b/packages/posthog/src/client.tsx@@ -1,6 +1,6 @@"use client";import posthog from "posthog-js";-import React from "react";+import type React from "react";export { usePostHog } from "posthog-js/react";@@ -25,13 +25,4 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) {return <BasePostHogProvider client={posthog}>{children}</BasePostHogProvider>;}-export function PostHogIdentify({ distinctId }: { distinctId?: string }) {- React.useEffect(() => {- if (distinctId) {- posthog?.identify(distinctId);- }- }, [distinctId]);- return null;-}-export { posthog };