1
0
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:
mihaisc 2024-05-27 15:26:51 +03:00 committed by GitHub
parent cb3a9ae1b4
commit 113af783df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,31 +15,9 @@ import MarketMetadataProvider from '@context/MarketMetadata'
import { WagmiConfig } from 'wagmi'
import { ConnectKitProvider } from 'connectkit'
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 {
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 (
<>
@ -55,11 +33,9 @@ function MyApp({ Component, pageProps }: AppProps): ReactElement {
<PricesProvider>
<ConsentProvider>
<OrbisProvider>
<PostHogProvider client={posthog}>
<App>
<Component {...pageProps} />
</App>
</PostHogProvider>
<App>
<Component {...pageProps} />
</App>
</OrbisProvider>
</ConsentProvider>
</PricesProvider>