mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Update _app.tsx (#2044)
* Update _app.tsx * Update _app.tsx * Update _app.tsx * fix lint
This commit is contained in:
parent
cb3a9ae1b4
commit
113af783df
@ -15,31 +15,9 @@ import MarketMetadataProvider from '@context/MarketMetadata'
|
|||||||
import { WagmiConfig } from 'wagmi'
|
import { WagmiConfig } from 'wagmi'
|
||||||
import { ConnectKitProvider } from 'connectkit'
|
import { ConnectKitProvider } from 'connectkit'
|
||||||
import { connectKitTheme, wagmiClient } from '@utils/wallet'
|
import { connectKitTheme, wagmiClient } from '@utils/wallet'
|
||||||
import posthog from 'posthog-js'
|
|
||||||
import { PostHogProvider } from 'posthog-js/react'
|
|
||||||
import { useRouter } from 'next/router'
|
|
||||||
|
|
||||||
// Check that PostHog is client-side (used to handle Next.js SSR)
|
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
|
|
||||||
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://eu.posthog.com',
|
|
||||||
persistence: 'memory'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps): ReactElement {
|
function MyApp({ Component, pageProps }: AppProps): ReactElement {
|
||||||
Decimal.set({ rounding: 1 })
|
Decimal.set({ rounding: 1 })
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Track page views
|
|
||||||
const handleRouteChange = () => posthog?.capture('$pageview')
|
|
||||||
router.events.on('routeChangeComplete', handleRouteChange)
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
router.events.off('routeChangeComplete', handleRouteChange)
|
|
||||||
}
|
|
||||||
}, [router.events])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -55,11 +33,9 @@ function MyApp({ Component, pageProps }: AppProps): ReactElement {
|
|||||||
<PricesProvider>
|
<PricesProvider>
|
||||||
<ConsentProvider>
|
<ConsentProvider>
|
||||||
<OrbisProvider>
|
<OrbisProvider>
|
||||||
<PostHogProvider client={posthog}>
|
|
||||||
<App>
|
<App>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</App>
|
</App>
|
||||||
</PostHogProvider>
|
|
||||||
</OrbisProvider>
|
</OrbisProvider>
|
||||||
</ConsentProvider>
|
</ConsentProvider>
|
||||||
</PricesProvider>
|
</PricesProvider>
|
||||||
|
Loading…
Reference in New Issue
Block a user