Skip to content

Commit a38208a

Browse files
committed
fix: Added the monkey business video and removed some errors with the imports for the Smooth Pursuit tasks
1 parent 881cd3e commit a38208a

File tree

5 files changed

+61
-51
lines changed

5 files changed

+61
-51
lines changed
3.37 MB
Binary file not shown.

webcamstudy/src/components/InstructionVideoTask.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
22

33
const INSTRUCTION_VIDEOS = [
44
{
5-
src: require('../assets/clip2.mp4'), // You'll need to add this video file
5+
src: require('../assets/monkey_business.mp4'), // You'll need to add this video file
66
type: 'video/mp4',
77
},
88
];

webcamstudy/src/components/SmoothPursuitVideoTask.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import React, { useEffect, useRef, useState } from 'react';
22

33
const SMOOTH_PURSUIT_VIDEOS = [
44
{
5-
src: require('../assets/smooth-pursuit/circle.mp4'),
5+
src: require('../assets/smooth-pursuit/Circle.mp4'),
66
name: 'Circle',
77
type: 'video/mp4',
88
},
99
{
10-
src: require('../assets/smooth-pursuit/square.mp4'),
10+
src: require('../assets/smooth-pursuit/Square.mp4'),
1111
name: 'Square',
1212
type: 'video/mp4',
1313
},
1414
{
15-
src: require('../assets/smooth-pursuit/infinity.mp4'),
15+
src: require('../assets/smooth-pursuit/Infinity.mp4'),
1616
name: 'Infinity',
1717
type: 'video/mp4',
1818
},
1919
{
20-
src: require('../assets/smooth-pursuit/star.mp4'),
20+
src: require('../assets/smooth-pursuit/Star.mp4'),
2121
name: 'Star',
2222
type: 'video/mp4',
2323
},
2424
{
25-
src: require('../assets/smooth-pursuit/triangle.mp4'),
25+
src: require('../assets/smooth-pursuit/Triangle.mp4'),
2626
name: 'Triangle',
2727
type: 'video/mp4',
2828
},

webcamstudy/src/components/TextSurvey.jsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,45 @@
1-
import React, { useState } from 'react';
1+
import React, { useState, useEffect } from 'react';
22

33
const TextSurvey = ({ onSubmit }) => {
44
const [selectedAnswer, setSelectedAnswer] = useState('');
5+
const [currentTextTask, setCurrentTextTask] = useState(null);
6+
7+
useEffect(() => {
8+
// Get the current text task from sessionStorage
9+
const storedTextTask = sessionStorage.getItem('currentTextTask');
10+
if (storedTextTask) {
11+
setCurrentTextTask(JSON.parse(storedTextTask));
12+
}
13+
}, []);
514

615
const handleSubmit = (e) => {
716
e.preventDefault();
817
const result = {
918
selectedAnswer,
19+
correctAnswer: currentTextTask?.correctAnswer,
20+
isCorrect: selectedAnswer === currentTextTask?.correctAnswer,
21+
textId: currentTextTask?.id,
1022
timestamp: new Date().toISOString()
1123
};
1224
onSubmit?.(result);
1325
};
1426

27+
if (!currentTextTask) {
28+
return (
29+
<div style={styles.container}>
30+
<div>Loading question...</div>
31+
</div>
32+
);
33+
}
34+
1535
return (
1636
<div style={styles.container}>
1737
<form onSubmit={handleSubmit} style={styles.form}>
1838
<h2 style={styles.title}>Text Comprehension Question</h2>
19-
<h3 style={styles.question}>What is the main theme of the passage you just read?</h3>
39+
<h3 style={styles.question}>{currentTextTask.question}</h3>
2040

2141
<div style={styles.radioGroup}>
22-
{[
23-
'Adventure and heroism',
24-
'Love and romance',
25-
'Science and technology',
26-
'Family relationships'
27-
].map(option => (
42+
{currentTextTask.answers.map(option => (
2843
<label key={option} style={styles.radioLabel}>
2944
<input
3045
type="radio"

webcamstudy/src/components/TextTask.jsx

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,47 @@
11
import React, { useEffect, useRef, useState } from 'react';
22

33
const TEXTS = [
4-
`Twas brillig, and the slithy toves
5-
Did gyre and gimble in the wabe:
6-
All mimsy were the borogoves,
7-
And the mome raths outgrabe.
8-
9-
"Beware the Jabberwock, my son!
10-
The jaws that bite, the claws that catch!
11-
Beware the Jubjub bird, and shun
12-
The frumious Bandersnatch!"
13-
14-
He took his vorpal sword in hand;
15-
Long time the manxome foe he sought—
16-
So rested he by the Tumtum tree
17-
And stood awhile in thought.
18-
19-
And, as in uffish thought he stood,
20-
The Jabberwock, with eyes of flame,
21-
Came whiffling through the tulgey wood,
22-
And burbled as it came!
23-
24-
One, two! One, two! And through and through
25-
The vorpal blade went snicker-snack!
26-
He left it dead, and with its head
27-
He went galumphing back.
28-
29-
"And hast thou slain the Jabberwock?
30-
Come to my arms, my beamish boy!
31-
O frabjous day! Callooh! Callay!"
32-
He chortled in his joy.
33-
34-
'Twas brillig, and the slithy toves
35-
Did gyre and gimble in the wabe:
36-
All mimsy were the borogoves,
37-
And the mome raths outgrabe.`,
4+
{
5+
id: 1,
6+
text: `In addition, a study was made of the planet's surface, which is covered by an ocean dotted with innumerable flat, low-lying islands whose combined area is less than that of Europe, although the diameter of Solaris is a fifth greater than Earth's. These expanses of barren, rocky territory, irregularly distributed, are largely concentrated in the southern hemisphere.`,
7+
question: "What is the planet's surface like?",
8+
answers: [
9+
'It has many low-lying islands.',
10+
'It has an island the size of Europe.',
11+
'It is a rocky area of around 600 square miles.',
12+
'It is mostly desert-like.'
13+
],
14+
correctAnswer: 'It has many low-lying islands.'
15+
},
16+
{
17+
id: 2,
18+
text: `The discovery of Solaris dated from about 100 years before I was born. The planet orbits two suns: a red sun and a blue sun. For 45 years after its discovery, no spacecraft had visited Solaris. At that time, the Gamow-Shapley theory — that life was impossible on planets which are satellites of two solar bodies — was firmly believed. The orbit is constantly being modified by variations in the gravitational pull in the course of its revolutions around the two suns.`,
19+
question: "How many suns does Solaris orbit around?",
20+
answers: [
21+
'Four',
22+
'Two',
23+
'One',
24+
'None'
25+
],
26+
correctAnswer: 'Two'
27+
}
3828
];
3929

4030
function pickRandomText() {
4131
return TEXTS[Math.floor(Math.random() * TEXTS.length)];
4232
}
4333

4434
const TextTask = () => {
45-
const [text] = useState(() => pickRandomText());
35+
const [selectedText] = useState(() => pickRandomText());
4636
const [showCross, setShowCross] = useState(true);
4737
const [showInstruction, setShowInstruction] = useState(false);
4838
const formattedTextRef = useRef(null);
4939

40+
// Store selected text in sessionStorage so TextSurvey can access it
41+
useEffect(() => {
42+
sessionStorage.setItem('currentTextTask', JSON.stringify(selectedText));
43+
}, [selectedText]);
44+
5045
useEffect(() => {
5146
// First show cross for 1 second
5247
const crossTimer = setTimeout(() => {
@@ -73,7 +68,7 @@ const TextTask = () => {
7368
let character_id = 0;
7469
let formattedTextContainer = formattedTextRef.current;
7570

76-
let cleanedText = text.replace(/\n+/g, ' ');
71+
let cleanedText = selectedText.text.replace(/\n+/g, ' ');
7772
let words = cleanedText.match(/[\w'']+|[.,!?;:"""-]|\s+/g) || [];
7873

7974
formattedTextContainer.innerHTML = '';
@@ -106,7 +101,7 @@ const TextTask = () => {
106101
sentenceCount++;
107102
}
108103
});
109-
}, [text, showCross, showInstruction]);
104+
}, [selectedText.text, showCross, showInstruction]);
110105

111106
return (
112107
<div style={styles.container}>

0 commit comments

Comments
 (0)