not found

This commit is contained in:
Sendou 2020-02-24 19:42:31 +02:00
parent 421975488e
commit aef2533959
13 changed files with 76 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View File

@ -39,6 +39,14 @@ import firstPlace from "./first_place.png"
import secondPlace from "./second_place.png"
import thirdPlace from "./third_place.png"
import alfonsino from "./Splatoon1Maps/alfonsino.png"
import bluefin from "./Splatoon1Maps/bluefin.png"
import bridge from "./Splatoon1Maps/bridge.png"
import flounder from "./Splatoon1Maps/flounder.png"
import resort from "./Splatoon1Maps/resort.png"
import rig from "./Splatoon1Maps/rig.png"
import underpass from "./Splatoon1Maps/underpass.png"
//https://stackoverflow.com/questions/42118296/dynamically-import-images-from-a-directory-using-webpack
export const wpnSmall: object = importAll(require.context("./wpnSmall", false))
export const wpnMedium: object = importAll(
@ -103,3 +111,34 @@ export const footerOcto = {
}
export const medalEmoji = [null, firstPlace, secondPlace, thirdPlace] as const
export const Splatoon1Maps = [
{
image: alfonsino,
name: "Museum D'Alfonsino",
},
{
image: bluefin,
name: "Bluefin Depot",
},
{
image: bridge,
name: "Hammerhead Bridge",
},
{
image: flounder,
name: "Flounder Heights",
},
{
image: resort,
name: "Mahi-Mahi Resort",
},
{
image: rig,
name: "Saltspray Rig",
},
{
image: underpass,
name: "Urchin Underpass",
},
]

View File

@ -1,11 +1,19 @@
import React, { useContext } from "react"
import React, { useState, useEffect, useContext } from "react"
import { Spinner, Box } from "@chakra-ui/core"
import MyThemeContext from "../../themeContext"
interface LoadingProps {}
const Loading: React.FC<LoadingProps> = () => {
const Loading: React.FC = () => {
const { themeColorWithShade } = useContext(MyThemeContext)
const [showSpinner, setShowSpinner] = useState(false)
useEffect(() => {
const timer = setTimeout(() => setShowSpinner(true), 1000)
return () => clearTimeout(timer)
}, [])
if (!showSpinner) return null
return (
<Box textAlign="center" pt="2em">
<Spinner

View File

@ -0,0 +1,22 @@
import React, { useContext } from "react"
import { RouteComponentProps } from "@reach/router"
import { Splatoon1Maps } from "../../assets/imageImports"
import { choose } from "../../utils/helperFunctions"
import { Image, Flex, Heading, Box } from "@chakra-ui/core"
import MyThemeContext from "../../themeContext"
const NotFound: React.FC<RouteComponentProps> = () => {
const { grayWithShade } = useContext(MyThemeContext)
const mapObject = choose(Splatoon1Maps)
return (
<Flex flexDirection="column" justifyContent="center" alignItems="center">
<Image src={mapObject.image} borderRadius="5px" w="500px" h="auto" />
<Heading mt="1em">404 - Not Found</Heading>
<Box color={grayWithShade}>
...just like {mapObject.name} can't be found in Splatoon 2
</Box>
</Flex>
)
}
export default NotFound

View File

@ -1,6 +1,7 @@
import React, { Suspense, lazy } from "react"
import { Router } from "@reach/router"
import Loading from "../common/Loading"
import NotFound from "./NotFound"
const HomePage = lazy(() => import("../home/HomePage"))
const UserPage = lazy(() => import("../user/UserPage"))
@ -21,7 +22,7 @@ const Routes: React.FC = () => {
<MapPlannerPage path="/plans" />
<CalendarPage path="/calendar" />
<FreeAgentsPage path="/freeagents" />
<HomePage default />
<NotFound default />
</Router>
</Suspense>
)

View File

@ -3,9 +3,7 @@ import UserAvatar from "../common/UserAvatar"
import Box from "../elements/Box"
import { useContext } from "react"
import MyThemeContext from "../../themeContext"
import { Icon } from "@chakra-ui/core"
import { FaTwitter, FaTrophy, FaDiscord } from "react-icons/fa"
import { Link } from "@reach/router"
import { months } from "../../utils/lists"
interface LogoHeaderProps {

View File

@ -1,4 +1,4 @@
export function choose(choices) {
export function choose(choices: any[]) {
var index = Math.floor(Math.random() * choices.length)
return choices[index]
}