62 lines
1.7 KiB
TypeScript
62 lines
1.7 KiB
TypeScript
import { json } from '@remix-run/node';
|
|
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
|
|
import { withSentry } from '@sentry/remix';
|
|
import styles from './styles/tailwind.css';
|
|
import { env, sentryEnvironment } from './env.server';
|
|
import type { LinksFunction, MetaFunction } from '@remix-run/node';
|
|
import type { PUBLIC_ENV } from './types';
|
|
|
|
export const meta: MetaFunction = () => ({
|
|
charset: 'utf-8',
|
|
title: '0x',
|
|
viewport: 'width=device-width,initial-scale=1',
|
|
});
|
|
|
|
export const links: LinksFunction = () => [
|
|
{ rel: 'stylesheet', href: styles },
|
|
//Preload only critical font
|
|
{
|
|
rel: 'preload',
|
|
as: 'font',
|
|
href: '/fonts/PolySans-Neutral.woff2',
|
|
type: 'font/woff2',
|
|
crossOrigin: 'anonymous',
|
|
},
|
|
];
|
|
|
|
export async function loader() {
|
|
return json({
|
|
ENV: {
|
|
SENTRY_ENV: sentryEnvironment,
|
|
SENTRY_DSN: env.SENTRY_DSN,
|
|
} as PUBLIC_ENV,
|
|
});
|
|
}
|
|
|
|
export function App() {
|
|
const data = useLoaderData<typeof loader>();
|
|
return (
|
|
<html lang="en">
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<Meta />
|
|
<Links />
|
|
</head>
|
|
<body>
|
|
<Outlet />
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `window.PUBLIC_ENV = ${JSON.stringify(data.ENV)}`,
|
|
}}
|
|
/>
|
|
<ScrollRestoration />
|
|
<Scripts />
|
|
<LiveReload />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
export default withSentry(App);
|