Skip to content

Commit

Permalink
fix: pushed old/wrong version
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoistP committed Dec 19, 2024
1 parent 2ed1368 commit 769e893
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,28 @@ import { Provider as JotaiProvider } from 'jotai'

import { Favicon } from 'src/assets'
import { Head, MainLayout } from 'src/components/layouts'
import useMatomoTracker from 'src/hooks/useMatomoTracker'
import 'src/i18next'
import { resources } from 'src/i18next'
import { MantineProviders } from 'src/providers'
import InitStoreProvider from 'src/providers/InitStoreProvider'
import store from 'src/store/store'

// Matomo property added to window object
declare global {
interface Window {
_paq?: unknown[]
}
}

const i18n = initLanguage(resources)

type AppProps = NextAppProps & {
colorScheme: MantineColorScheme
locale: string
env: {
THEGRAPH_API_KEY: string
MATOMO_URL: string
MATOMO_SITE_ID: string
}
}

Expand All @@ -59,8 +67,6 @@ const dashbordChains: ChainSelectConfig<RealtChains> = {

const env = process.env.NEXT_PUBLIC_ENV ?? 'development'
const walletConnectKey = process.env.NEXT_PUBLIC_WALLET_CONNECT_KEY ?? ''
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL ?? ''
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID ?? ''

const readOnly = getReadOnlyConnector(dashbordChains)
const walletConnect = getWalletConnectV2(
Expand All @@ -79,6 +85,8 @@ const libraryConnectors = getConnectors({
export const getServerSideProps = async () => ({
props: {
THEGRAPH_API_KEY: process.env.THEGRAPH_API_KEY,
MATOMO_URL: process.env.MATOMO_URL,
MATOMO_SITE_ID: process.env.MATOMO_SITE_ID,
},
})

Expand All @@ -100,19 +108,16 @@ const App = ({ Component, pageProps, colorScheme, env }: AppProps) => {
useEffect(() => {
// eslint-disable-next-line no-underscore-dangle
if (!window._paq) {
console.log('initMatomoNext')
// Triggered twice on page load when using strict mode in dev
// Note: Triggered twice on page load when using strict mode in DEV
initMatomoNext({
url: MATOMO_URL,
siteId: MATOMO_SITE_ID,
disableCookies: false, // TODO: cookie consent banner
url: process.env.MATOMO_URL ?? '',
siteId: process.env.MATOMO_SITE_ID ?? '',
disableCookies: false,
// excludeUrlsPatterns: [/^\/login.php/, /\?token=.+/],
})
}
}, [])

useMatomoTracker()

return (
<QueryClientProvider client={queryClient}>
<JotaiProvider>
Expand Down Expand Up @@ -144,6 +149,8 @@ App.getInitialProps = ({ ctx }: { ctx: GetServerSidePropsContext }) => {
return {
env: {
THEGRAPH_API_KEY: process.env.THEGRAPH_API_KEY,
MATOMO_URL: process.env.MATOMO_URL,
MATOMO_SITE_ID: process.env.MATOMO_SITE_ID,
},
colorScheme: getCookie('mantine-color-scheme', ctx) || 'dark',
locale: getCookie('react-i18next', ctx) || 'fr',
Expand Down

0 comments on commit 769e893

Please sign in to comment.