2
2
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
3
3
/* eslint-disable @typescript-eslint/no-unsafe-return */
4
4
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
5
- import { Badge , Text } from "@chakra-ui/react" ;
5
+ import { Badge , Center , Text } from "@chakra-ui/react" ;
6
6
import Quiz from "./Quiz" ;
7
7
import { useMemo , useState } from "react" ;
8
8
import { useSession } from "next-auth/react" ;
9
9
import { api } from "@/utils/api" ;
10
+ import { useAccount } from "wagmi" ;
11
+ import { ConnectButton } from "@rainbow-me/rainbowkit" ;
10
12
11
13
type QuizStatusCheckerTye = {
12
14
quiz : string ;
@@ -16,6 +18,7 @@ const QuizStatusChecker = ({ quiz }: QuizStatusCheckerTye) => {
16
18
const [ fetchNow , setFetchNow ] = useState < boolean > ( true ) ;
17
19
const [ quizCompleted , setQuizCompleted ] = useState < boolean > ( false ) ;
18
20
const { data : sessionData } = useSession ( ) ;
21
+ const { address, isDisconnected } = useAccount ( ) ;
19
22
20
23
// Requests
21
24
@@ -49,9 +52,25 @@ const QuizStatusChecker = ({ quiz }: QuizStatusCheckerTye) => {
49
52
}
50
53
} , [ allLessons , completedQuizzesAllData , fetchNow , quiz ] ) ;
51
54
52
- if ( completedQuizzesAllData === undefined ) return null ;
53
-
54
- return quizCompleted ? (
55
+ return isDisconnected || ! address ? (
56
+ < >
57
+ < Center >
58
+ < Text
59
+ fontWeight = "bold"
60
+ fontSize = "1.875rem"
61
+ letterSpacing = { - 0.025 }
62
+ color = "yellow.300"
63
+ as = "u"
64
+ >
65
+ Connect your wallet and Sign in to start the quiz
66
+ </ Text > { " " }
67
+ </ Center >
68
+ < br />
69
+ < Center >
70
+ < ConnectButton />
71
+ </ Center >
72
+ </ >
73
+ ) : quizCompleted ? (
55
74
< Badge
56
75
display = "flex"
57
76
margin = "auto"
0 commit comments