Skip to content

Commit c73fdc0

Browse files
authored
Merge pull request #59 from battlesquid/chore/posthog
feat: add posthog
2 parents 1ad6578 + 3b8c5cb commit c73fdc0

File tree

5 files changed

+67
-10
lines changed

5 files changed

+67
-10
lines changed

packages/app/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PUBLIC_POSTHOG_KEY=phc_ysadTKHzxDRpwRbkhlwAFjiotT3DOiyAq8riZUK0Q56
2+
PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

packages/app/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@
2222
"@urql/exchange-auth": "^2.2.0",
2323
"animejs": "^4.1.3",
2424
"gql.tada": "^1.8.10",
25+
"lz-string": "^1.5.0",
2526
"manifold-3d": "^3.2.1",
2627
"opentype.js": "^1.3.4",
2728
"points-on-path": "^0.2.1",
29+
"posthog-js": "^1.261.7",
2830
"react": "^18.3.1",
2931
"react-dom": "^18.3.1",
3032
"suspend-react": "^0.1.3",
3133
"three": "^0.169.0",
3234
"three-3mf-exporter": "^0.0.4",
3335
"three-stdlib": "^2.35.2",
3436
"urql": "^4.2.1",
35-
"zustand": "^5.0.5",
3637
"zod": "^4.1.5",
37-
"lz-string": "^1.5.0"
38+
"zustand": "^5.0.5"
3839
},
3940
"devDependencies": {
4041
"@octokit/graphql-schema": "^15.25.0",

packages/app/src/env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ interface ImportMetaEnv {
44
readonly PUBLIC_APP_NAME: string;
55
readonly PUBLIC_WORKER_URL: string;
66
readonly PUBLIC_WORKER_ENTERPRISE_URL: string;
7+
readonly PUBLIC_POSTHOG_KEY: string;
8+
readonly PUBLIC_POSTHOG_HOST: string;
79
}
810

911
interface ImportMeta {

packages/app/src/index.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { shadcnCssVariableResolver } from "./theme/css_variable_resolver";
88
import { shadcnTheme } from "./theme/theme";
99
import "./theme/style.css";
1010
import { createRouter, RouterProvider } from "@tanstack/react-router";
11+
import { PostHogProvider } from "posthog-js/react";
1112
import { routeTree } from "./routeTree.gen";
1213

1314
const router = createRouter({ routeTree });
@@ -22,15 +23,24 @@ if (rootEl) {
2223
const root = ReactDOM.createRoot(rootEl);
2324
root.render(
2425
<React.StrictMode>
25-
<MantineProvider
26-
theme={shadcnTheme}
27-
cssVariablesResolver={shadcnCssVariableResolver}
28-
forceColorScheme="dark"
26+
<PostHogProvider
27+
apiKey={import.meta.env.PUBLIC_POSTHOG_KEY}
28+
options={{
29+
name: import.meta.env.PUBLIC_APP_NAME,
30+
api_host: import.meta.env.PUBLIC_POSTHOG_HOST,
31+
defaults: "2025-05-24",
32+
}}
2933
>
30-
<Provider value={client}>
31-
<RouterProvider router={router} />
32-
</Provider>
33-
</MantineProvider>
34+
<MantineProvider
35+
theme={shadcnTheme}
36+
cssVariablesResolver={shadcnCssVariableResolver}
37+
forceColorScheme="dark"
38+
>
39+
<Provider value={client}>
40+
<RouterProvider router={router} />
41+
</Provider>
42+
</MantineProvider>
43+
</PostHogProvider>
3444
</React.StrictMode>,
3545
);
3646
}

pnpm-lock.yaml

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)