Skip to content

Commit 3898544

Browse files
committed
Implement 404 page
1 parent 5af2c20 commit 3898544

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

site/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { light } from "./theme"
77
import { BrowserRouter as Router, Route, Routes } from "react-router-dom"
88

99
import CliAuthenticationPage from "./pages/cli-auth"
10+
import NotFoundPage from "./pages/404"
1011
import IndexPage from "./pages/index"
1112
import LoginPage from "./pages/login"
1213
import ProjectsPage from "./pages/projects"
@@ -57,7 +58,7 @@ export const App: React.FC = () => {
5758
{/* Using path="*"" means "match anything", so this route
5859
acts like a catch-all for URLs that we don't have explicit
5960
routes for. */}
60-
<Route path="*" element={<div>404</div>} />
61+
<Route path="*" element={<NotFoundPage />} />
6162
</Route>
6263
</Routes>
6364
</ThemeProvider>

site/pages/404.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { makeStyles } from "@material-ui/core/styles"
2+
import React, { useEffect, useState } from "react"
3+
import { getApiKey } from "../api"
4+
import { CliAuthToken } from "../components/SignIn"
5+
6+
import { FullScreenLoader } from "../components/Loader/FullScreenLoader"
7+
import { useUser } from "../contexts/UserContext"
8+
import { Typography } from "@material-ui/core"
9+
10+
const CliAuthenticationPage: React.FC = () => {
11+
const { me } = useUser(true)
12+
const styles = useStyles()
13+
14+
return (
15+
<div className={styles.root}>
16+
<div className={styles.headingContainer}>
17+
<Typography variant="h4">404</Typography>
18+
</div>
19+
<Typography variant="body2">This page could not be found.</Typography>
20+
</div>
21+
)
22+
}
23+
24+
const useStyles = makeStyles((theme) => ({
25+
root: {
26+
width: "100vw",
27+
height: "100vh",
28+
display: "flex",
29+
flexDirection: "row",
30+
justifyContent: "center",
31+
alignItems: "center",
32+
},
33+
headingContainer: {
34+
margin: theme.spacing(1),
35+
padding: theme.spacing(1),
36+
borderRight: theme.palette.divider,
37+
},
38+
}))
39+
40+
export default CliAuthenticationPage

site/webpack.dev.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ const config: webpack.Configuration = {
2020
headers: {
2121
"Access-Control-Allow-Origin": "*",
2222
},
23-
historyApiFallback: {
24-
index: "html_templates/index.html",
25-
},
23+
historyApiFallback: true,
2624
hot: true,
2725
proxy: {
2826
"/api": "http://localhost:3000",

0 commit comments

Comments
 (0)