This commit is contained in:
Dhravya Shah 2024-08-06 12:55:43 -07:00
parent e652d3a10e
commit be05d4fe7f
7 changed files with 52 additions and 12 deletions

View file

@ -3,7 +3,7 @@ main = "src/index.ts"
compatibility_date = "2024-02-23"
node_compat = true
# tail_consumers = [{service = "new-cf-ai-backend-tail"}]
tail_consumers = [{service = "new-cf-ai-backend-tail"}]
[[services]]
binding = "THREAD"

View file

@ -6,6 +6,7 @@ import { GeistSans } from "geist/font/sans";
import { GeistMono } from "geist/font/mono";
import { cn } from "@repo/ui/lib/utils";
import { Toaster } from "@repo/ui/shadcn/toaster";
import { CSPostHogProvider } from "./providers";
const inter = Inter({ subsets: ["latin"] });
@ -75,16 +76,18 @@ export default function RootLayout({
></script>
</head>
{/* TODO: when lightmode support is added, remove the 'dark' class from the body tag */}
<body
className={cn(
`${inter.className} dark`,
GeistMono.variable,
GeistSans.variable,
)}
>
{children}
<Toaster />
</body>
<CSPostHogProvider>
<body
className={cn(
`${inter.className} dark`,
GeistMono.variable,
GeistSans.variable,
)}
>
{children}
<Toaster />
</body>
</CSPostHogProvider>
</html>
);
}

14
apps/web/app/providers.js Normal file
View file

@ -0,0 +1,14 @@
"use client";
import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";
if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
person_profiles: "identified_only",
});
}
const CSPostHogProvider = ({ children }) => {
return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
};

View file

@ -26,6 +26,8 @@ declare global {
RATELIMITER: {
limit: ({ key: string }) => { success: boolean };
};
NEXT_PUBLIC_POSTHOG_KEY: string;
NEXT_PUBLIC_POSTHOG_HOST: string;
}
}
}

View file

@ -30,6 +30,7 @@
"next": "^14.1.1",
"novel": "^0.4.2",
"nuqs": "^1.17.4",
"posthog-js": "^1.154.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-resizable-panels": "^2.0.19",

View file

@ -19,7 +19,8 @@
".next/types/**/*.ts",
"../../packages/ui/",
"../../packages/shared-types",
"./components"
"./components",
"app/providers.js"
],
"exclude": ["node_modules/"]
}

19
pnpm-lock.yaml generated
View file

@ -407,6 +407,9 @@ importers:
nuqs:
specifier: ^1.17.4
version: 1.17.6(next@14.2.5)
posthog-js:
specifier: ^1.154.5
version: 1.154.5
react:
specifier: ^18.2.0
version: 18.3.1
@ -20665,6 +20668,14 @@ packages:
xtend: 4.0.2
dev: false
/posthog-js@1.154.5:
resolution: {integrity: sha512-YYhWckDIRObfCrQpiLq+fdcDTIbQp8ebiKi0ueGohMRgugIG9LJVSpBgCeCHZm2C7sOxDUNcAr3T5VBDUSQoOg==}
dependencies:
fflate: 0.4.8
preact: 10.23.1
web-vitals: 4.2.2
dev: false
/preact-render-to-string@5.2.3(preact@10.11.3):
resolution: {integrity: sha512-aPDxUn5o3GhWdtJtW0svRC2SS/l8D9MAgo2+AWml+BhDImb27ALf04Q2d+AHqUUOc6RdSXFIBVa2gxzgMKgtZA==}
peerDependencies:
@ -20678,6 +20689,10 @@ packages:
resolution: {integrity: sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg==}
dev: false
/preact@10.23.1:
resolution: {integrity: sha512-O5UdRsNh4vdZaTieWe3XOgSpdMAmkIYBCT3VhQDlKrzyCm8lUYsk0fmVEvoQQifoOjFRTaHZO69ylrzTW2BH+A==}
dev: false
/precinct@12.1.2:
resolution: {integrity: sha512-x2qVN3oSOp3D05ihCd8XdkIPuEQsyte7PSxzLqiRgktu79S5Dr1I75/S+zAup8/0cwjoiJTQztE9h0/sWp9bJQ==}
engines: {node: '>=18'}
@ -24541,6 +24556,10 @@ packages:
resolution: {integrity: sha512-6BjspCO9VriYy12z356nL6JBS0GYeEcA457YyRzD+dD6XYCQ75NKhcOHUMHentOE7OcVCIXXDvOm0jKFfQG2Gg==}
dev: true
/web-vitals@4.2.2:
resolution: {integrity: sha512-nYfoOqb4EmElljyXU2qdeE76KsvoHdftQKY4DzA9Aw8DervCg2bG634pHLrJ/d6+B4mE3nWTSJv8Mo7B2mbZkw==}
dev: false
/webextension-polyfill-ts@0.26.0:
resolution: {integrity: sha512-XEFL+aYVEsm/d4RajVwP75g56c/w2aSHnPwgtUv8/nCzbLNSzRQIix6aj1xqFkA5yr7OIDkk3OD/QTnPp8ThYA==}
deprecated: This project has moved to @types/webextension-polyfill