forked from git-truck/git-truck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroot.tsx
95 lines (85 loc) · 2.23 KB
/
root.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { useKonami } from "react-konami-code"
import type { MetaFunction } from "@remix-run/node"
import type { ErrorBoundaryComponent } from "@remix-run/node"
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useCatch } from "@remix-run/react"
import appStyles from "~/styles/App.css"
import varsStyles from "~/styles/vars.css"
import indexStyles from "~/styles/index.css"
import chartStyles from "~/styles/Chart.css"
import datapickerInput from "~/styles/DatapickerInput.css"
import datapickerStyles from "react-datepicker/dist/react-datepicker.css"
import { useEffect } from "react"
import { Code } from "./components/util"
export const meta: MetaFunction = () => {
return { title: "Git Truck Beta" }
}
export function links() {
return [
...[appStyles, varsStyles, datapickerInput, datapickerStyles, indexStyles, chartStyles].map((x) => ({
rel: "stylesheet",
href: x,
})),
{
rel: "favicon",
type: "image/x-icon",
href: "favicon.ico",
},
]
}
export default function App() {
useKonami(() => window.open("https://fruit-rush.joglr.dev", "_self"))
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta />
<Links />
{typeof document === "undefined" ? "__STYLES__" : null}
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
)
}
export function CatchBoundary() {
const caught = useCatch()
return (
<html>
<head>
<title>Oops! An error wasn't handled</title>
<Meta />
<Links />
</head>
<body>
<h1>
{caught.status} {caught.statusText}
</h1>
<Scripts />
</body>
</html>
)
}
export const ErrorBoundary: ErrorBoundaryComponent = ({ error }) => {
useEffect(() => {
console.error(error.message)
}, [error])
return (
<html>
<head>
<title>Oops! An error wasn't handled</title>
<Meta />
<Links />
</head>
<body>
<h1>{error.message}</h1>
<Code>{error.stack}</Code>
<Scripts />
</body>
</html>
)
}