28 lines
688 B
TypeScript
28 lines
688 B
TypeScript
"use client";
|
|
|
|
import { ThemeProvider } from "next-themes"
|
|
import { ReactNode } from "react"
|
|
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: 'always',
|
|
})
|
|
}
|
|
|
|
export function Providers({ children }: { children: ReactNode }) {
|
|
return (
|
|
<PostHogProvider client={posthog}>
|
|
<ThemeProvider
|
|
attribute="class"
|
|
defaultTheme="system"
|
|
enableSystem
|
|
disableTransitionOnChange
|
|
>
|
|
{children}
|
|
</ThemeProvider>
|
|
</PostHogProvider>
|
|
)
|
|
} |