File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!-- This is for when GitHub pages is stupid -->
2+ <!doctype html>
3+ < html lang ="en ">
4+ < head >
5+ < meta charset ="UTF-8 " />
6+ < meta http-equiv ="refresh " content ="0; url=/?redirect=%2F " />
7+ < script >
8+ const redirect = window . location . pathname ;
9+ const search = window . location . search ;
10+ const hash = window . location . hash ;
11+
12+ const newUrl =
13+ "/" + "?redirect=" + encodeURIComponent ( redirect + search + hash ) ;
14+
15+ window . location . replace ( newUrl ) ;
16+ </ script >
17+ < title > Redirecting…</ title >
18+ </ head >
19+ < body > </ body >
20+ </ html >
Original file line number Diff line number Diff line change 11import { Outlet } from "react-router-dom" ;
2- import SetColor from "./components/SetColor" ;
32import SwitcherLink from "./components/SwitcherLink" ;
43
54export default function Layout ( ) {
65 return (
76 < body className = "antialiased flex flex-col min-h-screen align-middle" >
87 < div className = "flex flex-col min-h-dvh" >
9- < SetColor />
108 < header className = "backdrop-blur-3xl border-b sticky top-0 min-w-full z-100" >
119 < nav className = "flex gap-10 h-10 justify-center" >
1210 < SwitcherLink to = "" name = "Home" > </ SwitcherLink >
Original file line number Diff line number Diff line change 11import { StrictMode } from "react" ;
22import { createRoot } from "react-dom/client" ;
33import { createBrowserRouter , RouterProvider } from "react-router-dom" ;
4+ import SetColor from "./components/SetColor" ;
45import "./index.css" ;
56import Layout from "./layout" ;
67import Home from "./pages" ;
78import About from "./pages/about" ;
89import ActualAbout from "./pages/aboutActual" ;
10+ import ErrorPage from "./pages/error" ;
911import Games from "./pages/games" ;
1012
1113const routes = [
1214 {
1315 path : "/" ,
1416 element : < Layout /> ,
17+ errorElement : < ErrorPage /> ,
1518 children : [
1619 {
1720 index : true ,
@@ -38,6 +41,7 @@ const router = createBrowserRouter(routes, {
3841
3942createRoot ( document . getElementById ( "root" ) ! ) . render (
4043 < StrictMode >
44+ < SetColor />
4145 < RouterProvider router = { router } />
4246 </ StrictMode > ,
4347) ;
Original file line number Diff line number Diff line change 1+ import { isRouteErrorResponse , useRouteError } from "react-router" ;
2+
3+ const ErrorPage = ( ) => {
4+ const error = useRouteError ( ) ;
5+
6+ if ( isRouteErrorResponse ( error ) ) {
7+ return (
8+ < div className = "flex flex-col items-center gap-5 h-dvh place-content-center" >
9+ < h1 className = "justify-center text-7xl w-fit text-primary overflow-hidden font-fancy" >
10+ { error . status } { error . statusText }
11+ </ h1 >
12+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
13+ Uh oh!
14+ </ h2 >
15+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
16+ Developer info: { error . data }
17+ </ h2 >
18+ </ div >
19+ ) ;
20+ } else if ( error instanceof Error ) {
21+ return (
22+ < div className = "flex flex-col items-center gap-5 h-dvh place-content-center" >
23+ < h1 className = "justify-center text-7xl w-fit text-primary overflow-hidden font-fancy" >
24+ Error!
25+ </ h1 >
26+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
27+ Uh oh!
28+ </ h2 >
29+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
30+ { error . message }
31+ </ h2 >
32+ < br />
33+
34+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
35+ Developer info:
36+ </ h2 >
37+ < pre > { error . stack } </ pre >
38+ </ div >
39+ ) ;
40+ } else {
41+ return (
42+ < div className = "flex flex-col items-center gap-5 h-dvh place-content-center" >
43+ < h1 className = "justify-center text-7xl w-fit text-primary overflow-hidden font-fancy" >
44+ Unknown error!
45+ </ h1 >
46+ < h2 className = "justify-center text-3xl w-fit text-secondary overflow-clip font-semifancy" >
47+ Uh oh!
48+ </ h2 >
49+ </ div >
50+ ) ;
51+ }
52+ } ;
53+
54+ export default ErrorPage ;
You can’t perform that action at this time.
0 commit comments