2021-09-09 13:51:06 +00:00
|
|
|
import Document, { DocumentContext, Head, Html, Main, NextScript, DocumentProps } from "next/document";
|
2021-07-07 19:58:18 +00:00
|
|
|
|
2021-09-09 13:51:06 +00:00
|
|
|
type Props = Record<string, unknown> & DocumentProps;
|
|
|
|
|
|
|
|
class MyDocument extends Document<Props> {
|
|
|
|
static async getInitialProps(ctx: DocumentContext) {
|
2021-07-07 19:58:18 +00:00
|
|
|
const initialProps = await Document.getInitialProps(ctx);
|
2022-03-31 08:45:47 +00:00
|
|
|
const isEmbed = ctx.req?.url?.includes("embed");
|
|
|
|
return { ...initialProps, isEmbed };
|
2021-07-07 19:58:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2022-03-31 08:45:47 +00:00
|
|
|
const props = this.props;
|
2022-02-01 22:17:37 +00:00
|
|
|
const { locale } = this.props.__NEXT_DATA__;
|
|
|
|
const dir = locale === "ar" || locale === "he" ? "rtl" : "ltr";
|
|
|
|
|
2021-07-07 19:58:18 +00:00
|
|
|
return (
|
2022-02-01 22:17:37 +00:00
|
|
|
<Html lang={locale} dir={dir}>
|
2021-08-03 09:32:37 +00:00
|
|
|
<Head>
|
2021-08-03 09:39:06 +00:00
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
|
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
|
|
|
<link rel="manifest" href="/site.webmanifest" />
|
|
|
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000" />
|
|
|
|
<meta name="msapplication-TileColor" content="#ff0000" />
|
|
|
|
<meta name="theme-color" content="#ffffff" />
|
2021-08-03 09:32:37 +00:00
|
|
|
</Head>
|
2022-03-31 08:45:47 +00:00
|
|
|
|
|
|
|
{/* Keep the embed hidden till parent initializes and gives it the appropriate styles */}
|
|
|
|
<body className="bg-gray-100 dark:bg-neutral-900" style={props.isEmbed ? { display: "none" } : {}}>
|
2021-07-07 19:58:18 +00:00
|
|
|
<Main />
|
|
|
|
<NextScript />
|
|
|
|
</body>
|
|
|
|
</Html>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MyDocument;
|