wizr-quiz 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +14 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +30 -0
- package/rollup.config-1745339193645.cjs +50 -0
- package/rollup.config.js +45 -0
- package/src/assets/Timer.svg +3 -0
- package/src/assets/close.svg +4 -0
- package/src/assets/downArrow.svg +11 -0
- package/src/assets/fonts/patron/patron-black.woff2 +0 -0
- package/src/assets/fonts/patron/patron-blackitalic.woff2 +0 -0
- package/src/assets/fonts/patron/patron-bold.woff2 +0 -0
- package/src/assets/fonts/patron/patron-bolditalic.woff2 +0 -0
- package/src/assets/fonts/patron/patron-italic.woff2 +0 -0
- package/src/assets/fonts/patron/patron-light.woff2 +0 -0
- package/src/assets/fonts/patron/patron-lightitalic.woff2 +0 -0
- package/src/assets/fonts/patron/patron-medium.woff2 +0 -0
- package/src/assets/fonts/patron/patron-mediumitalic.woff2 +0 -0
- package/src/assets/fonts/patron/patron-regular.woff2 +0 -0
- package/src/assets/fonts/patron/patron-thin.woff2 +0 -0
- package/src/assets/fonts/patron/patron-thinitalic.woff2 +0 -0
- package/src/assets/fonts/quintus/Quintus_B_trial.ttf +0 -0
- package/src/assets/fonts/quintus/Quintus_R_trial.ttf +0 -0
- package/src/assets/react.svg +1 -0
- package/src/components/Options.tsx +27 -0
- package/src/components/Question.tsx +18 -0
- package/src/components/Quiz.tsx +297 -0
- package/src/components/Timer.tsx +53 -0
- package/src/components/loader.tsx +12 -0
- package/src/components/quizEndScreen.tsx +20 -0
- package/src/components/tabSwitchModal.tsx +30 -0
- package/src/hooks/useDisableCopyPaste.ts +25 -0
- package/src/hooks/useTabSwitch.tsx +29 -0
- package/src/index.ts +3 -0
- package/src/styles/fonts.css +44 -0
- package/src/styles/loader.css +27 -0
- package/src/styles/options.css +58 -0
- package/src/styles/question.css +40 -0
- package/src/styles/quiz.css +267 -0
- package/src/styles/quizEndScreen.css +33 -0
- package/src/styles/tabSwitchModal.css +78 -0
- package/src/styles/timer.css +5 -0
- package/src/svg.d.ts +6 -0
- package/src/types/index.ts +60 -0
- package/tsconfig.json +20 -0
- package/wizr-quiz-1.0.0.tgz +0 -0
- package/wizr-sdk-1.0.0.tgz +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.quiz-page {
|
|
6
|
+
position: fixed;
|
|
7
|
+
background: white;
|
|
8
|
+
width: 100vw;
|
|
9
|
+
min-height: 100dvh;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
z-index: 100;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
overflow-y: auto; /* ensure scrolling works */
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.quiz-page-container {
|
|
20
|
+
flex: 1;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
border-radius: 16px;
|
|
24
|
+
margin: 24px 16px 0px 16px;
|
|
25
|
+
height: 100%;
|
|
26
|
+
background: #f8f5f2; /* Same background color */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Ticker stays in a row on all devices */
|
|
30
|
+
.quiz-ticker {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
padding: 20px 20px;
|
|
35
|
+
border-bottom: 1px solid #e1d8c9;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.quiz-ticker-right {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 2rem;
|
|
43
|
+
padding-right: 2rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.quiz-container {
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
width: 100%;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row; /* side-by-side on desktop */
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
padding: 24px 56px 24px;
|
|
53
|
+
border-radius: 10px;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
max-width: 1600px;
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
max-height: 80dvh;
|
|
59
|
+
overflow: auto;
|
|
60
|
+
gap: 2rem;
|
|
61
|
+
scrollbar-width: none; /* Firefox */
|
|
62
|
+
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.quiz-container::-webkit-scrollbar {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Left & Right columns on desktop */
|
|
70
|
+
.quiz-left {
|
|
71
|
+
width: 100%;
|
|
72
|
+
max-width: 650px;
|
|
73
|
+
overflow: auto;
|
|
74
|
+
scrollbar-width: thin;
|
|
75
|
+
scrollbar-color: #ccc transparent; /* thumb color, track color */
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* WebKit-based browsers (Chrome, Safari, Edge) */
|
|
79
|
+
.quiz-left::-webkit-scrollbar {
|
|
80
|
+
width: 6px; /* slim scrollbar */
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.quiz-left::-webkit-scrollbar-thumb {
|
|
84
|
+
background-color: #ccc; /* grey thumb */
|
|
85
|
+
border-radius: 4px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.quiz-left::-webkit-scrollbar-track {
|
|
89
|
+
background: transparent; /* optional: transparent track */
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.quiz-right {
|
|
93
|
+
max-width: 622px;
|
|
94
|
+
width: 100%;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.quiz-right-head {
|
|
98
|
+
display: flex;
|
|
99
|
+
justify-content: space-between;
|
|
100
|
+
align-items: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.choose-option {
|
|
104
|
+
font-size: 1rem;
|
|
105
|
+
font-family: "Patron", sans-serif;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
line-height: 32px;
|
|
108
|
+
letter-spacing: 0.2%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.question-count {
|
|
112
|
+
font-size: 0.9rem;
|
|
113
|
+
font-family: "Patron", sans-serif;
|
|
114
|
+
color: #161c20;
|
|
115
|
+
font-weight: 500;
|
|
116
|
+
line-height: 1.2rem;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.options-container {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
gap: 18px;
|
|
123
|
+
margin-top: 12px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.mobile-next-btn {
|
|
127
|
+
display: none;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Button Styles */
|
|
131
|
+
.prev-btn,
|
|
132
|
+
.next-btn {
|
|
133
|
+
padding: 10px 54px;
|
|
134
|
+
background: #000000;
|
|
135
|
+
color: #ffffff;
|
|
136
|
+
border: none;
|
|
137
|
+
border-radius: 24px;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
transition: 0.3s;
|
|
140
|
+
font-size: 0.9rem;
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
font-family: "Patron", sans-serif;
|
|
143
|
+
line-height: 21px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.prev-btn {
|
|
147
|
+
background: #5d4037;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.next-btn:disabled {
|
|
151
|
+
background: #d7ccc8;
|
|
152
|
+
cursor: not-allowed;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.scroll-down-btn {
|
|
156
|
+
position: fixed;
|
|
157
|
+
bottom: 20px;
|
|
158
|
+
right: 20px;
|
|
159
|
+
z-index: 999;
|
|
160
|
+
border: none;
|
|
161
|
+
border-radius: 50%;
|
|
162
|
+
padding: 4px;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
font-size: 20px;
|
|
165
|
+
transition: background 0.3s;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.bounce {
|
|
169
|
+
animation: bounce 1.6s infinite;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@keyframes bounce {
|
|
173
|
+
0%,
|
|
174
|
+
20%,
|
|
175
|
+
50%,
|
|
176
|
+
80%,
|
|
177
|
+
100% {
|
|
178
|
+
transform: translateY(0px);
|
|
179
|
+
}
|
|
180
|
+
40% {
|
|
181
|
+
transform: translateY(-4px);
|
|
182
|
+
}
|
|
183
|
+
60% {
|
|
184
|
+
transform: translateY(-2px);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* RESPONSIVE LAYOUT */
|
|
189
|
+
@media (max-width: 768px) {
|
|
190
|
+
/* Stack quiz content vertically on mobile */
|
|
191
|
+
|
|
192
|
+
.quiz-page-container {
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
padding: 16px;
|
|
195
|
+
gap: 1rem;
|
|
196
|
+
overflow-y: auto;
|
|
197
|
+
margin: 0;
|
|
198
|
+
border-radius: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.quiz-container {
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
padding: 0;
|
|
204
|
+
justify-content: space-between;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.quiz-ticker {
|
|
208
|
+
padding: 3px 20px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.quiz-left {
|
|
212
|
+
max-height: none;
|
|
213
|
+
overflow: initial;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.quiz-ticker-right {
|
|
217
|
+
padding-right: 0px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.choose-option {
|
|
221
|
+
font-size: 0.95rem;
|
|
222
|
+
}
|
|
223
|
+
/* Keep the ticker in a row at the top (no change) */
|
|
224
|
+
|
|
225
|
+
/* Fix the next button at the bottom on mobile */
|
|
226
|
+
.next-btn-container {
|
|
227
|
+
display: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.mobile-next-btn {
|
|
231
|
+
display: block;
|
|
232
|
+
position: fixed;
|
|
233
|
+
left: 0;
|
|
234
|
+
bottom: 0;
|
|
235
|
+
margin: 0 auto;
|
|
236
|
+
text-align: center;
|
|
237
|
+
z-index: 101;
|
|
238
|
+
width: 100%;
|
|
239
|
+
padding: 12px 0;
|
|
240
|
+
border-top: 1px solid #dddddd;
|
|
241
|
+
background: #f8f5f2; /* Same background color */
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.next-btn {
|
|
245
|
+
padding: 12px 72px;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.question-count {
|
|
249
|
+
font-size: 0.95rem;
|
|
250
|
+
}
|
|
251
|
+
.option-btn {
|
|
252
|
+
font-size: 0.8rem;
|
|
253
|
+
padding: 10px;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@media (max-width: 768px) and (max-height: 800px) {
|
|
258
|
+
.quiz-container {
|
|
259
|
+
padding-bottom: 65px;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@media (max-width: 768px) and (max-height: 500px) {
|
|
264
|
+
.quiz-container {
|
|
265
|
+
padding-bottom: 100px;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.end-screen-overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background: #222;
|
|
8
|
+
color: #fff;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
z-index: 1000;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Content */
|
|
16
|
+
.end-screen-content {
|
|
17
|
+
text-align: center;
|
|
18
|
+
font-size: 20px;
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
font-family: "Patron", sans-serif;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.end-screen-close {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 20px;
|
|
26
|
+
right: 20px;
|
|
27
|
+
background: none;
|
|
28
|
+
border: none;
|
|
29
|
+
font-size: 24px;
|
|
30
|
+
color: #fff;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
font-family: "Patron", sans-serif;
|
|
33
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* Modal Background Overlay */
|
|
2
|
+
.modal-overlay {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
background: rgba(0, 0, 0, 0.6);
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
z-index: 1000;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/* Modal Box */
|
|
16
|
+
.modal-content {
|
|
17
|
+
background: #222;
|
|
18
|
+
color: #fff;
|
|
19
|
+
padding: 20px;
|
|
20
|
+
border-radius: 10px;
|
|
21
|
+
width: 400px;
|
|
22
|
+
text-align: center;
|
|
23
|
+
position: relative;
|
|
24
|
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Close Button */
|
|
28
|
+
.modal-close {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 10px;
|
|
31
|
+
right: 15px;
|
|
32
|
+
background: none;
|
|
33
|
+
border: none;
|
|
34
|
+
font-size: 24px;
|
|
35
|
+
color: #fff;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
font-family: "Patron", sans-serif;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Header */
|
|
41
|
+
.modal-header {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
margin-bottom: 10px;
|
|
46
|
+
font-family: "Patron", sans-serif;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Warning Icon */
|
|
50
|
+
.modal-icon {
|
|
51
|
+
font-size: 32px;
|
|
52
|
+
color: #ffcc00;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Text */
|
|
56
|
+
.modal-text {
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
color: #ccc;
|
|
59
|
+
margin-bottom: 20px;
|
|
60
|
+
font-family: "Patron", sans-serif;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Button */
|
|
64
|
+
.modal-button {
|
|
65
|
+
background: #fff;
|
|
66
|
+
color: #222;
|
|
67
|
+
border: none;
|
|
68
|
+
padding: 10px 20px;
|
|
69
|
+
border-radius: 20px;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
transition: 0.3s;
|
|
73
|
+
font-family: "Patron", sans-serif;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.modal-button:hover {
|
|
77
|
+
background: #ddd;
|
|
78
|
+
}
|
package/src/svg.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export interface IQuizProps {
|
|
2
|
+
userId: string;
|
|
3
|
+
quizId: string;
|
|
4
|
+
tabSwitchLimit: number;
|
|
5
|
+
onQuizComplete: () => Promise<void>;
|
|
6
|
+
baseURL: string;
|
|
7
|
+
token: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface OptionsProps {
|
|
11
|
+
options: Option[];
|
|
12
|
+
selectedOption: string | null;
|
|
13
|
+
onSelect: (optionId: string) => void;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface QuestionProps {
|
|
18
|
+
question: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface QuizEndScreenProps {
|
|
22
|
+
open: boolean;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface TabSwitchModalProps {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface TimerProps {
|
|
32
|
+
duration: number;
|
|
33
|
+
markQuizComplete: () => Promise<void>;
|
|
34
|
+
isEndScreenOpen: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface Option {
|
|
38
|
+
id: string;
|
|
39
|
+
text: string;
|
|
40
|
+
media: string[];
|
|
41
|
+
code: string | null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Question {
|
|
45
|
+
id: string;
|
|
46
|
+
text: string;
|
|
47
|
+
media: string[];
|
|
48
|
+
code: string | null;
|
|
49
|
+
type: "MCQ";
|
|
50
|
+
maxScore: number;
|
|
51
|
+
options: Option[];
|
|
52
|
+
conceptId: string;
|
|
53
|
+
level: "easy" | "medium" | "hard";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface QuizData {
|
|
57
|
+
questions: Question[];
|
|
58
|
+
duration: number;
|
|
59
|
+
id: string;
|
|
60
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES5",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noFallthroughCasesInSwitch": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx"
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
Binary file
|
|
Binary file
|