Skip to content

Commit

Permalink
Merge pull request #67 from jcari-dev/66-rendering-board-bug
Browse files Browse the repository at this point in the history
added bug notifier
  • Loading branch information
jcari-dev authored Aug 23, 2024
2 parents 7a1f0ed + 0f28c12 commit 62e00b0
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
66 changes: 66 additions & 0 deletions chess/src/components/main/home/BugNotifier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React, { useEffect } from "react";
import {
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
ModalFooter,
Text,
useDisclosure,
Button,
} from "@chakra-ui/react";

function BugNotifier() {
const OverlayOne = () => (
<ModalOverlay
bg="none"
backdropFilter="auto"
backdropInvert="80%"
backdropBlur="2px"
/>
);

const { isOpen, onOpen, onClose } = useDisclosure();

useEffect(() => {
const checkServerResponse = () => {
onOpen();
};


checkServerResponse();
}, [onOpen]);

return (
<>
<Modal isCentered isOpen={isOpen} onClose={onClose}>
<OverlayOne />
<ModalContent>
<ModalHeader>Uh Oh!</ModalHeader>
<ModalCloseButton />
<ModalBody>
<Text mb={4}>
Please note, there is a known rendering issue in CPU matches that
may prevent you from completing the game (but feel free to give it
a try!).
</Text>

<Text mb={4}>
This bug does not affect player vs player mode and is currently
being addressed!
</Text>
</ModalBody>
<ModalFooter>
<Button colorScheme="blue" mr={3} onClick={onClose}>
Got it, thanks for the heads up!
</Button>
</ModalFooter>
</ModalContent>
</Modal>
</>
);
}

export default BugNotifier;
2 changes: 2 additions & 0 deletions chess/src/pages/cpu/Cpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useNavigate } from "react-router-dom";
import endpoints from "../../utils/Endpoints";
import { getCsrfToken } from "../../utils/Auth";
import { useAuth0 } from "@auth0/auth0-react";
import BugNotifier from "../../components/main/home/BugNotifier";

function CpuDispatch() {
const [difficulty, setDifficulty] = React.useState(0);
Expand Down Expand Up @@ -80,6 +81,7 @@ function CpuDispatch() {

return (
<Flex height="100vh" alignItems="center" justifyContent="center">
<BugNotifier/>
<Box width="60%" p={5} shadow="md" borderWidth="1px">
<VStack spacing={4}>
<Text fontSize="xl">Choose Your Difficulty</Text>
Expand Down

0 comments on commit 62e00b0

Please sign in to comment.