2021-06-21 21:35:28 +00:00
|
|
|
import NextDocument, {
|
|
|
|
Html,
|
|
|
|
Head,
|
|
|
|
Main,
|
|
|
|
NextScript,
|
|
|
|
DocumentContext,
|
|
|
|
} from 'next/document'
|
2021-06-03 16:13:23 +00:00
|
|
|
import { dark, getCssString } from 'styles'
|
2021-06-19 09:00:44 +00:00
|
|
|
import { GA_TRACKING_ID } from 'utils/gtag'
|
2021-05-09 12:03:39 +00:00
|
|
|
|
2021-05-09 21:22:25 +00:00
|
|
|
class MyDocument extends NextDocument {
|
2021-06-21 21:35:28 +00:00
|
|
|
static async getInitialProps(ctx: DocumentContext): Promise<{
|
|
|
|
styles: JSX.Element
|
|
|
|
html: string
|
|
|
|
head?: JSX.Element[]
|
|
|
|
}> {
|
2021-05-09 21:22:25 +00:00
|
|
|
try {
|
|
|
|
const initialProps = await NextDocument.getInitialProps(ctx)
|
|
|
|
|
|
|
|
return {
|
|
|
|
...initialProps,
|
|
|
|
styles: (
|
|
|
|
<>
|
|
|
|
{initialProps.styles}
|
|
|
|
<style
|
|
|
|
id="stitches"
|
|
|
|
dangerouslySetInnerHTML={{ __html: getCssString() }}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
}
|
|
|
|
} catch (e) {
|
2021-05-25 09:09:51 +00:00
|
|
|
console.error(e.message)
|
2021-05-09 21:22:25 +00:00
|
|
|
} finally {
|
2021-06-21 21:35:28 +00:00
|
|
|
null
|
2021-05-09 21:22:25 +00:00
|
|
|
}
|
2021-05-09 12:03:39 +00:00
|
|
|
}
|
|
|
|
|
2021-06-21 21:35:28 +00:00
|
|
|
render(): JSX.Element {
|
2021-05-09 12:03:39 +00:00
|
|
|
return (
|
2021-05-09 21:22:25 +00:00
|
|
|
<Html lang="en">
|
2021-06-11 12:37:09 +00:00
|
|
|
<Head>
|
2021-06-11 20:14:43 +00:00
|
|
|
<link rel="manifest" href="/manifest.json" />
|
|
|
|
<link rel="shortcut icon" href="/favicon.ico" />
|
2021-06-11 12:37:09 +00:00
|
|
|
<meta name="application-name" content="tldraw" />
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
|
|
<meta name="apple-mobile-web-app-title" content="tldraw" />
|
|
|
|
<meta name="description" content="A tiny little drawing app." />
|
|
|
|
<meta name="format-detection" content="telephone=no" />
|
|
|
|
<meta name="mobile-web-app-capable" content="yes" />
|
2021-06-11 20:14:43 +00:00
|
|
|
<meta name="theme-color" content="#fafafa" />
|
2021-06-11 12:37:09 +00:00
|
|
|
<meta name="twitter:card" content="summary" />
|
|
|
|
<meta name="twitter:url" content="https://tldraw.com" />
|
|
|
|
<meta name="twitter:title" content="tldraw" />
|
|
|
|
<meta
|
|
|
|
name="twitter:description"
|
|
|
|
content="A tiny little drawing app."
|
|
|
|
/>
|
|
|
|
<meta name="twitter:creator" content="@steveruizok" />
|
|
|
|
<meta property="og:type" content="website" />
|
|
|
|
<meta property="og:title" content="tldraw" />
|
|
|
|
<meta
|
|
|
|
property="og:description"
|
|
|
|
content="A tiny little drawing app."
|
|
|
|
/>
|
|
|
|
<meta property="og:site_name" content="tldraw" />
|
|
|
|
<meta property="og:url" content="https://tldraw.com" />
|
2021-06-19 09:00:44 +00:00
|
|
|
<script
|
|
|
|
async
|
|
|
|
src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
|
|
|
|
/>
|
|
|
|
<script
|
|
|
|
dangerouslySetInnerHTML={{
|
|
|
|
__html: `
|
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', '${GA_TRACKING_ID}', {
|
|
|
|
page_path: window.location.pathname,
|
|
|
|
});
|
|
|
|
`,
|
|
|
|
}}
|
|
|
|
/>
|
2021-06-11 12:37:09 +00:00
|
|
|
</Head>
|
2021-05-09 12:03:39 +00:00
|
|
|
<body className={dark}>
|
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</Html>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MyDocument
|