Files
grungnet/src/routes/Home.js
T

149 lines
4.2 KiB
JavaScript
Raw Normal View History

import React, { useState, useEffect } from "react";
2020-07-12 19:51:55 +10:00
import { Flex, Button, Image, Text, IconButton, Link } from "theme-ui";
2020-10-16 22:09:36 +11:00
import { useHistory } from "react-router-dom";
2020-04-09 18:19:07 +10:00
import Footer from "../components/Footer";
2020-04-14 16:05:44 +10:00
import StartModal from "../modals/StartModal";
2020-04-13 18:29:46 +10:00
import JoinModal from "../modals/JoinModal";
2020-11-27 11:23:20 +11:00
import GettingStartedModal from "../modals/GettingStartedModal";
import HelpIcon from "../icons/HelpIcon";
2020-04-13 18:29:46 +10:00
import { useAuth } from "../contexts/AuthContext";
2020-04-14 16:05:44 +10:00
2020-07-12 19:51:55 +10:00
import RedditIcon from "../icons/SocialRedditIcon";
import TwitterIcon from "../icons/SocialTwitterIcon";
import YouTubeIcon from "../icons/SocialYouTubeIcon";
2020-10-16 22:09:36 +11:00
import DonateIcon from "../icons/DonateIcon";
2021-01-06 16:32:27 +11:00
import PatreonIcon from "../icons/SocialPatreonIcon";
2020-07-12 19:51:55 +10:00
import owlington from "../images/Owlington.png";
2020-03-16 21:31:08 +11:00
function Home() {
2020-04-14 16:05:44 +10:00
const [isStartModalOpen, setIsStartModalOpen] = useState(false);
2020-04-13 18:29:46 +10:00
const [isJoinModalOpen, setIsJoinModalOpen] = useState(false);
2020-11-27 11:23:20 +11:00
const [isGettingStartedModalOpen, setIsGettingStartedModalOpen] = useState(
false
);
2020-04-14 16:05:44 +10:00
// Reset password on visiting home
const { setPassword } = useAuth();
2020-04-14 16:05:44 +10:00
useEffect(() => {
setPassword("");
}, [setPassword]);
2020-10-16 22:09:36 +11:00
const history = useHistory();
2020-03-16 21:50:40 +11:00
return (
2020-04-09 18:19:07 +10:00
<Flex
sx={{
flexDirection: "column",
justifyContent: "space-between",
minHeight: "100%",
alignItems: "center",
}}
>
2020-03-19 17:33:57 +11:00
<Flex
sx={{
flexDirection: "column",
2020-04-05 22:20:34 +10:00
justifyContent: "center",
2020-04-09 18:19:07 +10:00
maxWidth: "300px",
flexGrow: 1,
2020-03-19 17:33:57 +11:00
}}
2020-04-09 18:19:07 +10:00
mb={2}
2020-03-19 17:33:57 +11:00
>
<Text variant="display" as="h1" sx={{ textAlign: "center" }}>
Owlbear Rodeo
2020-03-26 12:24:52 +11:00
</Text>
<Image src={owlington} m={2} />
2020-11-27 11:23:20 +11:00
<Button
variant="secondary"
m={2}
onClick={() => setIsGettingStartedModalOpen(true)}
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
Getting Started <HelpIcon />
</Button>
2020-04-14 16:05:44 +10:00
<Button m={2} onClick={() => setIsStartModalOpen(true)}>
2020-03-16 21:50:40 +11:00
Start Game
</Button>
2020-04-13 18:29:46 +10:00
<Button m={2} onClick={() => setIsJoinModalOpen(true)}>
2020-03-16 21:50:40 +11:00
Join Game
</Button>
<Text variant="caption" as="p" sx={{ textAlign: "center" }}>
2020-08-07 14:35:30 +10:00
Beta v{process.env.REACT_APP_VERSION}
</Text>
2021-01-06 16:32:27 +11:00
<Button
as="a"
href="https://patreon.com/owlbearrodeo"
mt={4}
mx={2}
mb={2}
sx={{
display: "flex",
alignItems: "flex-end",
justifyContent: "center",
}}
>
Patreon <PatreonIcon />
</Button>
2020-04-15 12:51:03 +10:00
<Button
2020-10-16 22:09:36 +11:00
as="a"
href="/donate"
2021-01-06 16:32:27 +11:00
mt={2}
mb={4}
2020-10-16 22:09:36 +11:00
mx={2}
onClick={(e) => {
e.preventDefault();
history.push("/donate");
}}
sx={{
display: "flex",
alignItems: "flex-end",
justifyContent: "center",
}}
2020-04-15 12:51:03 +10:00
>
2020-10-16 22:09:36 +11:00
Donate <DonateIcon />
2020-04-15 12:51:03 +10:00
</Button>
2020-10-16 22:09:36 +11:00
<Flex mb={4} mt={0} sx={{ justifyContent: "center" }}>
2020-07-12 19:51:55 +10:00
<Link href="https://www.reddit.com/r/OwlbearRodeo/">
<IconButton title="Reddit" aria-label="Reddit">
<RedditIcon />
</IconButton>
</Link>
<Link href="https://twitter.com/OwlbearRodeo">
<IconButton title="Twitter" aria-label="Twitter">
<TwitterIcon />
</IconButton>
</Link>
<Link href="https://www.youtube.com/channel/UCePe1wJC53_7fbBbSECG7YQ">
<IconButton title="YouTube" aria-label="YouTube">
<YouTubeIcon />
</IconButton>
</Link>
</Flex>
2020-04-13 18:29:46 +10:00
<JoinModal
isOpen={isJoinModalOpen}
onRequestClose={() => setIsJoinModalOpen(false)}
/>
2020-04-14 16:05:44 +10:00
<StartModal
isOpen={isStartModalOpen}
onRequestClose={() => setIsStartModalOpen(false)}
/>
2020-11-27 11:23:20 +11:00
<GettingStartedModal
isOpen={isGettingStartedModalOpen}
onRequestClose={() => setIsGettingStartedModalOpen(false)}
/>
2020-03-16 21:50:40 +11:00
</Flex>
2020-04-09 18:19:07 +10:00
<Footer />
</Flex>
2020-03-16 21:50:40 +11:00
);
2020-03-16 21:31:08 +11:00
}
2020-03-16 21:50:40 +11:00
export default Home;