Skip to content

Commit

Permalink
Merge branch 'dev' into l10n_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Mar 28, 2024
2 parents 85207d7 + d8400b4 commit c508b4d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
39 changes: 21 additions & 18 deletions apps/app/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { type AppProps, type NextWebVitalsMetric } from 'next/app'
import dynamic from 'next/dynamic'
import Head from 'next/head'
import { useRouter } from 'next/router'
import Script from 'next/script'
import { type Session } from 'next-auth'
import { appWithTranslation, type UserConfig } from 'next-i18next'
import { appWithTranslation } from 'next-i18next'
import { DefaultSeo, type DefaultSeoProps } from 'next-seo'
import { GoogleAnalytics } from 'nextjs-google-analytics'

Expand Down Expand Up @@ -51,27 +52,24 @@ export function reportWebVitals(stats: NextWebVitalsMetric) {
appEvent.webVitals(stats)
}

const PageContent = ({ Component, ...pageProps }: AppPropsWithGridSwitch) => {
const router = useRouter()
const autoResetState = Component.autoResetState ? { key: router.asPath } : {}
return Component.omitGrid ? (
<Component {...autoResetState} {...pageProps} />
) : (
<BodyGrid>
<Component {...autoResetState} {...pageProps} />
</BodyGrid>
)
}

const MyApp = (appProps: AppPropsWithGridSwitch) => {
const {
Component,
pageProps: { session, ...pageProps },
pageProps: { session },
} = appProps

const router = useRouter()

const { isMobile, isTablet } = useScreenSize()

const autoResetState = Component.autoResetState ? { key: router.asPath } : {}

const PageContent = () =>
Component.omitGrid ? (
<Component {...autoResetState} {...pageProps} />
) : (
<BodyGrid>
<Component {...autoResetState} {...pageProps} />
</BodyGrid>
)

return (
<>
<Head>
Expand All @@ -80,9 +78,14 @@ const MyApp = (appProps: AppPropsWithGridSwitch) => {
<Providers session={session}>
<DefaultSeo {...defaultSEO} />
<GoogleAnalytics trackPageViews defaultConsent='granted' />
<Script id='gtm_conversion'>
{`
gtag?.('config','G-RL8CR7T4EP')
`}
</Script>
<PageLoadProgress />
<Navbar />
<PageContent />
<PageContent {...appProps} />
{(isMobile || isTablet) && <Space h={80} />}
<Footer />
<Notifications transitionDuration={500} />
Expand Down
8 changes: 4 additions & 4 deletions apps/app/src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createStylesServer, ServerStyles } from '@mantine/next'
import Document, { type DocumentContext, Head, Html, Main, NextScript } from 'next/document'
import NextDocument, { type DocumentContext, Head, Html, Main, NextScript } from 'next/document'
import Script from 'next/script'

import { appCache } from '@weareinreach/ui/theme'

import i18nextConfig from '../../next-i18next.config.mjs'

const stylesServer = createStylesServer(appCache)
export default class _Document extends Document {
export default class Document extends NextDocument {
static async getInitialProps(ctx: DocumentContext) {
const initialProps = await Document.getInitialProps(ctx)
const initialProps = await NextDocument.getInitialProps(ctx)
return {
...initialProps,
styles: [
Expand All @@ -20,7 +20,7 @@ export default class _Document extends Document {
}

render() {
const currentLocale = this.props.__NEXT_DATA__.locale || i18nextConfig.i18n.defaultLocale
const currentLocale = this.props.__NEXT_DATA__.locale ?? i18nextConfig.i18n.defaultLocale
return (
<Html lang={currentLocale}>
<Head>
Expand Down

0 comments on commit c508b4d

Please sign in to comment.