0ecff1b581
* add heap * remove hotjar * prettier formatting conflicting with es lint * stop weird prettier/eslint conflict
98 lines
3.8 KiB
TypeScript
98 lines
3.8 KiB
TypeScript
import 'tailwindcss/tailwind.css'
|
|
import type { AppProps } from 'next/app'
|
|
import { useEffect } from 'react'
|
|
import Head from 'next/head'
|
|
import Script from 'next/script'
|
|
import { usePreserveScroll } from 'web/hooks/use-preserve-scroll'
|
|
import { QueryClient, QueryClientProvider } from 'react-query'
|
|
import { ENV_CONFIG } from 'common/envs/constants'
|
|
|
|
function firstLine(msg: string) {
|
|
return msg.replace(/\r?\n.*/s, '')
|
|
}
|
|
|
|
function printBuildInfo() {
|
|
// These are undefined if e.g. dev server
|
|
if (process.env.NEXT_PUBLIC_VERCEL_ENV) {
|
|
const env = process.env.NEXT_PUBLIC_VERCEL_ENV
|
|
const msg = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE
|
|
const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER
|
|
const repo = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG
|
|
const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA
|
|
const url = `https://github.com/${owner}/${repo}/commit/${sha}`
|
|
console.info(`Build: ${env} / ${firstLine(msg || '???')} / ${url}`)
|
|
}
|
|
}
|
|
|
|
function MyApp({ Component, pageProps }: AppProps) {
|
|
usePreserveScroll()
|
|
|
|
useEffect(printBuildInfo, [])
|
|
|
|
return (
|
|
<>
|
|
<Script src="https://www.googletagmanager.com/gtag/js?id=G-SSFK1Q138D" />
|
|
<Script id="google-analytics">
|
|
{`
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
gtag('config', 'G-SSFK1Q138D');
|
|
`}
|
|
</Script>
|
|
{ENV_CONFIG.heapId && (
|
|
<Script id="heap-analytics">
|
|
{`window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
|
|
heap.load("${ENV_CONFIG.heapId}");`}
|
|
</Script>
|
|
)}
|
|
<Head>
|
|
<title>Manifold Markets — A market for every question</title>
|
|
|
|
<meta
|
|
property="og:title"
|
|
name="twitter:title"
|
|
content="Manifold Markets — A market for every question"
|
|
key="title"
|
|
/>
|
|
<meta
|
|
name="description"
|
|
content="Manifold Markets lets you create a market on any question. Sign up in 30 seconds and start trading on politics, sports, or anything that interests you."
|
|
key="description1"
|
|
/>
|
|
<meta
|
|
property="og:description"
|
|
name="twitter:description"
|
|
content="Manifold Markets lets you create a market on any question. Sign up in 30 seconds and start trading on politics, sports, or anything that interests you."
|
|
key="description2"
|
|
/>
|
|
<meta property="og:url" content="https://manifold.markets" key="url" />
|
|
<meta name="twitter:card" content="summary" key="card" />
|
|
<meta name="twitter:site" content="@manifoldmarkets" />
|
|
<meta
|
|
property="og:image"
|
|
content="https://manifold.markets/logo-cover.png"
|
|
key="image1"
|
|
/>
|
|
<meta
|
|
name="twitter:image"
|
|
content="https://manifold.markets/logo-bg-white.png"
|
|
key="image2"
|
|
/>
|
|
<meta
|
|
name="viewport"
|
|
content="width=device-width, initial-scale=1, maximum-scale=1"
|
|
/>
|
|
</Head>
|
|
|
|
<QueryClientProvider client={queryClient}>
|
|
<Component {...pageProps} />
|
|
</QueryClientProvider>
|
|
</>
|
|
)
|
|
}
|
|
|
|
const queryClient = new QueryClient()
|
|
|
|
export default MyApp
|