2021-12-02 23:49:46 +00:00
import 'tailwindcss/tailwind.css'
import type { AppProps } from 'next/app'
2022-05-11 03:57:09 +00:00
import { useEffect } from 'react'
2021-12-16 04:52:07 +00:00
import Head from 'next/head'
2022-05-10 21:49:24 +00:00
import Script from 'next/script'
2022-05-09 13:04:36 +00:00
import { usePreserveScroll } from 'web/hooks/use-preserve-scroll'
2022-05-12 15:07:10 +00:00
import { QueryClient , QueryClientProvider } from 'react-query'
2022-06-14 16:54:58 +00:00
import { ENV_CONFIG } from 'common/envs/constants'
2021-12-01 04:20:13 +00:00
2022-05-11 04:12:00 +00:00
function firstLine ( msg : string ) {
return msg . replace ( / \ r ? \ n . * / s , ' ' )
}
2022-05-11 03:57:09 +00:00
function printBuildInfo() {
// These are undefined if e.g. dev server
if ( process . env . NEXT_PUBLIC_VERCEL_ENV ) {
2022-05-26 21:41:24 +00:00
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 } `
2022-05-11 04:12:00 +00:00
console . info ( ` Build: ${ env } / ${ firstLine ( msg || '???' ) } / ${ url } ` )
2022-05-11 03:57:09 +00:00
}
}
2021-12-01 04:20:13 +00:00
function MyApp ( { Component , pageProps } : AppProps ) {
2022-01-15 00:43:00 +00:00
usePreserveScroll ( )
2022-05-13 18:33:02 +00:00
useEffect ( printBuildInfo , [ ] )
2022-05-11 03:57:09 +00:00
2021-12-16 04:52:07 +00:00
return (
< >
2022-05-10 21:49:24 +00:00
< 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 >
2022-06-14 16:54:58 +00:00
{ 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 >
) }
2021-12-16 04:52:07 +00:00
< Head >
2022-04-06 18:20:16 +00:00
< title > Manifold Markets — A market for every question < / title >
2021-12-16 04:52:07 +00:00
< meta
property = "og:title"
name = "twitter:title"
2022-04-06 18:20:16 +00:00
content = "Manifold Markets — A market for every question"
2021-12-16 04:52:07 +00:00
key = "title"
/ >
< meta
name = "description"
2022-04-06 18:20:16 +00:00
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."
2021-12-16 18:40:23 +00:00
key = "description1"
2021-12-16 04:52:07 +00:00
/ >
< meta
property = "og:description"
name = "twitter:description"
2022-04-06 18:20:16 +00:00
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."
2021-12-16 18:40:23 +00:00
key = "description2"
2021-12-16 04:52:07 +00:00
/ >
2022-01-06 18:48:30 +00:00
< meta property = "og:url" content = "https://manifold.markets" key = "url" / >
2022-01-10 07:05:24 +00:00
< meta name = "twitter:card" content = "summary" key = "card" / >
2022-01-06 18:48:30 +00:00
< meta name = "twitter:site" content = "@manifoldmarkets" / >
2021-12-16 04:52:07 +00:00
< meta
property = "og:image"
2022-01-10 05:50:31 +00:00
content = "https://manifold.markets/logo-cover.png"
2022-01-10 07:05:24 +00:00
key = "image1"
2022-01-07 03:54:11 +00:00
/ >
< meta
2021-12-16 04:52:07 +00:00
name = "twitter:image"
2022-01-11 06:16:58 +00:00
content = "https://manifold.markets/logo-bg-white.png"
2022-01-10 07:05:24 +00:00
key = "image2"
2021-12-16 04:52:07 +00:00
/ >
2022-04-07 03:54:44 +00:00
< meta
name = "viewport"
content = "width=device-width, initial-scale=1, maximum-scale=1"
/ >
2021-12-16 04:52:07 +00:00
< / Head >
2022-05-12 15:07:10 +00:00
< QueryClientProvider client = { queryClient } >
< Component { ...pageProps } / >
< / QueryClientProvider >
2021-12-16 04:52:07 +00:00
< / >
)
2021-12-01 04:20:13 +00:00
}
2022-05-12 15:07:10 +00:00
const queryClient = new QueryClient ( )
2021-12-02 23:49:46 +00:00
export default MyApp