-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
287 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Image, Text, VStack } from "@chakra-ui/react"; | ||
|
||
export const Loader = () => { | ||
export const Loader = ({ text = "LOADING ..."}: { text?: string}) => { | ||
return ( | ||
<VStack gap={3}> | ||
<Image src="/images/loading.gif" alt="loading" width="60px" height="60px" margin="auto" /> | ||
<Text fontFamily="broken-console" fontSize="12px" color="neon.500">LOADING ...</Text> | ||
<Text fontFamily="broken-console" fontSize="12px" color="neon.500">{text}</Text> | ||
</VStack> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Modal, ModalBody, ModalContent, ModalOverlay, VStack } from "@chakra-ui/react"; | ||
import { observer } from "mobx-react-lite"; | ||
import { useState } from "react"; | ||
import { Loader } from "./Loader"; | ||
|
||
export const LoadingModal = observer(() => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
// useLayoutEffect(() => { | ||
// const onDOMContentLoaded = (event: any) => { | ||
// if (event.target.readyState === "complete") { | ||
// setIsLoading(false); | ||
// } | ||
// }; | ||
|
||
// window.addEventListener("load", (event) => { | ||
// onDOMContentLoaded(event); | ||
// }, false); | ||
// return () => { | ||
// window.removeEventListener("load", onDOMContentLoaded); | ||
// }; | ||
// }, []); | ||
|
||
return ( | ||
<Modal motionPreset="slideInBottom" isCentered isOpen={isLoading} onClose={() =>{}}> | ||
<ModalOverlay /> | ||
<ModalContent bg="bg.dark" maxW="360px"> | ||
<ModalBody p={6}> | ||
<VStack w="full" gap={6}> | ||
<Loader text="LOADING ASSETS ..." /> | ||
</VStack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useDojoContext } from "@/dojo/hooks"; | ||
import { | ||
Button, | ||
HStack, | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalHeader, | ||
ModalOverlay, | ||
Text, | ||
VStack, | ||
} from "@chakra-ui/react"; | ||
import { observer } from "mobx-react-lite"; | ||
import { useRouter } from "next/router"; | ||
|
||
export const QuitGameModal = observer(() => { | ||
const router = useRouter(); | ||
const { uiStore } = useDojoContext(); | ||
|
||
return ( | ||
<Modal motionPreset="slideInBottom" isCentered isOpen={uiStore.modals.quitGame !== undefined} onClose={() => {}}> | ||
<ModalOverlay /> | ||
<ModalContent bg="bg.dark" maxW="360px"> | ||
<ModalHeader textAlign="center">Quit game</ModalHeader> | ||
<ModalBody p={6}> | ||
<VStack w="full" gap={6}> | ||
<Text>Are you sure ?</Text> | ||
<HStack w="full" justifyContent="center"> | ||
<Button | ||
onClick={() => { | ||
uiStore.closeQuitGame(); | ||
router.push("/"); | ||
}} | ||
> | ||
YES | ||
</Button> | ||
<Button onClick={() => uiStore.closeQuitGame()}>CANCEL</Button> | ||
</HStack> | ||
</VStack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useDojoContext } from "@/dojo/hooks"; | ||
import { Modal, ModalBody, ModalContent, ModalOverlay, VStack } from "@chakra-ui/react"; | ||
import { observer } from "mobx-react-lite"; | ||
import { useEffect, useState } from "react"; | ||
import { Loader } from "../layout/Loader"; | ||
|
||
export const DeployingModal = observer(() => { | ||
const { burnerManager, isPrefundingPaper } = useDojoContext(); | ||
|
||
const [text, setText] = useState("Loading ..."); | ||
|
||
// const isDeploying = useMemo(() => { | ||
// return burnerManager?.isDeploying | ||
// }, [burnerManager, burnerManager?.isDeploying]); | ||
|
||
// useEffect(() => { | ||
// setIsDeploying(burnerManager?.isDeploying); | ||
// }, [burnerManager?.isDeploying]); | ||
|
||
const [isDeploying, setIsDeploying] = useState(false); | ||
useEffect(() => { | ||
const handle = setInterval(() => { | ||
setIsDeploying(burnerManager?.isDeploying || false); | ||
}, 500); | ||
return () => { | ||
clearInterval(handle); | ||
}; | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (isDeploying) { | ||
setText("Deploying burner..."); | ||
} | ||
|
||
if (isPrefundingPaper) { | ||
setText("Paper Airdrop burner..."); | ||
} | ||
}, [isDeploying, isPrefundingPaper]); | ||
|
||
return ( | ||
<Modal motionPreset="slideInBottom" isCentered isOpen={isDeploying || isPrefundingPaper} onClose={() => {}}> | ||
<ModalOverlay /> | ||
<ModalContent bg="bg.dark" maxW="360px"> | ||
<ModalBody p={6}> | ||
<VStack w="full" gap={6}> | ||
<Loader text={text} /> | ||
</VStack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.