From 02abfb33b759455aa7ed5e8d648eba8924104ac2 Mon Sep 17 00:00:00 2001 From: hexedout Date: Sat, 21 Jan 2023 17:17:19 +0000 Subject: [PATCH 1/2] 404 page --- .../react-app/public/assets/not_found.svg | 1 + packages/react-app/src/App.jsx | 7 +++++ .../src/views/ChallengeDetailView.jsx | 3 +- packages/react-app/src/views/NotFoundView.jsx | 29 +++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 packages/react-app/public/assets/not_found.svg create mode 100644 packages/react-app/src/views/NotFoundView.jsx diff --git a/packages/react-app/public/assets/not_found.svg b/packages/react-app/public/assets/not_found.svg new file mode 100644 index 00000000..218d8339 --- /dev/null +++ b/packages/react-app/public/assets/not_found.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/react-app/src/App.jsx b/packages/react-app/src/App.jsx index 1ad7fd10..28ad0112 100644 --- a/packages/react-app/src/App.jsx +++ b/packages/react-app/src/App.jsx @@ -21,6 +21,7 @@ import { USER_ROLES } from "./helpers/constants"; import { providerPromiseWrapper } from "./helpers/blockchainProviders"; import BlockchainProvidersContext from "./contexts/blockchainProvidersContext"; import SiteFooter from "./components/SiteFooter"; +import NotFoundView from "./views/NotFoundView"; // 😬 Sorry for all the console logging const DEBUG = true; @@ -215,6 +216,12 @@ function App() { + + + + + + diff --git a/packages/react-app/src/views/ChallengeDetailView.jsx b/packages/react-app/src/views/ChallengeDetailView.jsx index b0af25b1..4f67aed2 100644 --- a/packages/react-app/src/views/ChallengeDetailView.jsx +++ b/packages/react-app/src/views/ChallengeDetailView.jsx @@ -67,9 +67,8 @@ export default function ChallengeDetailView({ serverUrl, address, userProvider, }, [isAnonymous, isWalletConnected, onOpen, userRole, openModalOnLoad, setOpenModalOnLoad]); if (!challenge) { - // TODO implement a 404 page - // this looks good: https://ant.design/components/result/#components-result-demo-404 history.push("/404"); + return null; } const handleSubmitChallengeModal = async () => { diff --git a/packages/react-app/src/views/NotFoundView.jsx b/packages/react-app/src/views/NotFoundView.jsx new file mode 100644 index 00000000..027b3ba1 --- /dev/null +++ b/packages/react-app/src/views/NotFoundView.jsx @@ -0,0 +1,29 @@ +import React from "react"; +import { Box, Button, Container, Heading, Image, Link, Text, useColorModeValue } from "@chakra-ui/react"; +import { NavLink } from "react-router-dom"; + +export default function NotFoundView() { + const bgColor = useColorModeValue("sre.cardBackground", "sreDark.cardBackground"); + + return ( + + + + 404 + + Sorry, the page you visited does not exist. + + + + + + + ); +} From ab7da75d4a39f2bc76ea6f310d1fff50a56c666f Mon Sep 17 00:00:00 2001 From: hexedout Date: Sat, 21 Jan 2023 17:19:38 +0000 Subject: [PATCH 2/2] normal link --- packages/react-app/src/views/NotFoundView.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-app/src/views/NotFoundView.jsx b/packages/react-app/src/views/NotFoundView.jsx index 027b3ba1..4e61fb02 100644 --- a/packages/react-app/src/views/NotFoundView.jsx +++ b/packages/react-app/src/views/NotFoundView.jsx @@ -1,6 +1,6 @@ import React from "react"; import { Box, Button, Container, Heading, Image, Link, Text, useColorModeValue } from "@chakra-ui/react"; -import { NavLink } from "react-router-dom"; +import { Link as RouterLink } from "react-router-dom"; export default function NotFoundView() { const bgColor = useColorModeValue("sre.cardBackground", "sreDark.cardBackground"); @@ -20,7 +20,7 @@ export default function NotFoundView() { > Sorry, the page you visited does not exist. - +