diff --git a/web/src/CenteredSpinner.tsx b/web/src/CenteredSpinner.tsx new file mode 100644 index 0000000..fef8e6b --- /dev/null +++ b/web/src/CenteredSpinner.tsx @@ -0,0 +1,16 @@ +import { Box, Spinner } from "@chakra-ui/react"; + +const CenteredSpinner = () => ( + + + +); + +export default CenteredSpinner; diff --git a/web/src/Leaderboard.tsx b/web/src/Leaderboard.tsx index 3fc5865..1dddeff 100644 --- a/web/src/Leaderboard.tsx +++ b/web/src/Leaderboard.tsx @@ -1,13 +1,12 @@ import { Heading, - Spinner, Table, TableContainer, Tbody, Td, Th, - Thead, Text, + Thead, Tr, } from "@chakra-ui/react"; import { formatDistance } from "date-fns"; @@ -22,6 +21,7 @@ import metadata from "./metadata.json"; import { CHAIN_ID } from "./env"; import { LeaderboardEntry, processLeaderboard } from "./lib"; import { useBurnerWallet } from "./hooks/useBurnerWallet"; +import CenteredSpinner from "./CenteredSpinner"; const EMOJIS = metadata.keys.map((k) => k.emoji); @@ -59,8 +59,6 @@ function LeaderboardComponent() { return `${address?.slice(0, 6)}...${address?.slice(address?.length - 3, address?.length)}`; } - console.log(leaderboardEntries); - return ( <> Leaderboard @@ -107,7 +105,7 @@ function LeaderboardComponent() { - {status === "pending" && } + {status === "pending" && } ); } diff --git a/web/src/Puzzle.tsx b/web/src/Puzzle.tsx index 975b814..8a37d20 100644 --- a/web/src/Puzzle.tsx +++ b/web/src/Puzzle.tsx @@ -28,7 +28,7 @@ function Puzzle(props: PuzzleProps) { ); useEffect(() => { - console.log(gelatoStatus); + console.log("Gelato status", gelatoStatus); if (gelatoStatus === "error") { toast.closeAll(); toast({ diff --git a/web/src/Quest.tsx b/web/src/Quest.tsx index 0fc00cc..e876f76 100644 --- a/web/src/Quest.tsx +++ b/web/src/Quest.tsx @@ -1,10 +1,11 @@ -import { Heading, VStack } from "@chakra-ui/react"; +import { Box, Heading, VStack } from "@chakra-ui/react"; import { useChapter } from "./hooks/useChapter"; import Markdown from "react-markdown"; -import ChakraUIRenderer from "chakra-ui-markdown-renderer"; import Puzzle from "./Puzzle"; import rehypeRaw from "rehype-raw"; import { checkSolutionMatch } from "./lib"; +import CenteredSpinner from "./CenteredSpinner"; +import "./markdown.css"; function Quest() { const { @@ -14,6 +15,10 @@ function Quest() { isLast, } = useChapter(); + const isLoading = + currentSmartContractChapterIndex === undefined || + currentChapterContent.length === 0; + return ( - - - Chapter {currentSmartContractChapterIndex} - - value} - rehypePlugins={[rehypeRaw]} - > - {currentChapterContent} - - + {isLoading ? ( + + ) : ( + + + Chapter {currentSmartContractChapterIndex} + + +
+ value} + rehypePlugins={[rehypeRaw]} + > + {currentChapterContent} + +
+
+
+ )}
); } diff --git a/web/src/hooks/gelato.tsx b/web/src/hooks/gelato.tsx index d88144d..597209f 100644 --- a/web/src/hooks/gelato.tsx +++ b/web/src/hooks/gelato.tsx @@ -44,7 +44,7 @@ export function useSubmitSolution( function handleTaskStateChange() { const taskState = taskStatus?.taskState as string; - console.log(taskState); + console.log("Task state change", taskState); if ( ["CheckPending", "ExecPending", "WaitingForConfirmation"].includes( taskState @@ -62,7 +62,7 @@ export function useSubmitSolution( } async function relay() { - console.log(`relay ${solution}`); + console.log("Relay", solution); if (!address || !signer) { throw "missing account"; } @@ -78,7 +78,6 @@ export function useSubmitSolution( const response = await relayRequest(encodedCall, address, signer); setTaskId(response.taskId); await fetchTaskStatus(response.taskId); - console.log(`set ${index} to taskId ${response.taskId}`); } async function poll() { @@ -112,7 +111,7 @@ export function useSubmitSolution( status: Status | undefined, info?: { data?: string; error?: string } ) { - console.log(`status ${status}`); + console.log("Task status", status); setStatus(status); setError(info?.error); setData(info?.data); @@ -123,9 +122,6 @@ export function useSubmitSolution( } useEffect(() => { - console.log(index); - console.log(solution); - console.log(address); if ( solution !== "" && address && diff --git a/web/src/markdown.css b/web/src/markdown.css new file mode 100644 index 0000000..ca05819 --- /dev/null +++ b/web/src/markdown.css @@ -0,0 +1,13 @@ +.markdown h1 { + font-size: 2em; + font-weight: bold; +} + +.markdown h2 { + font-size: 1.5em; + font-weight: bold; +} + +.markdown p { + margin-bottom: 1em; +}