- Prevent the CTRL+F on Reading;

- Made the Listening audio appear on exercises;
This commit is contained in:
Tiago Ribeiro
2023-08-31 20:39:38 +01:00
parent 7dd96bf259
commit b3b804fc11
4 changed files with 19 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ function Blank({
return (
<input
className="py-2 px-3 rounded-2xl w-48 bg-white focus:outline-none my-2"
className="py-2 px-3 mx-2 rounded-2xl w-48 bg-white focus:outline-none my-2"
placeholder={id}
onChange={(e) => setUserInput(e.target.value)}
onBlur={() => setUserSolution(userInput)}
@@ -91,10 +91,10 @@ export default function WriteBlanks({id, prompt, type, maxWords, solutions, user
<div className="flex flex-col gap-4 mt-4 h-full mb-20">
<span className="text-sm w-full leading-6">
{prompt.split("\\n").map((line, index) => (
<Fragment key={index}>
<span key={index}>
{line}
<br />
</Fragment>
</span>
))}
</span>
<span className="bg-mti-gray-smoke rounded-xl px-5 py-6">

View File

@@ -123,7 +123,7 @@ export default function Listening({exam, showSolutions = false, onFinish}: Props
totalExercises={exam.exercises.length}
disableTimer={showSolutions}
/>
{exerciseIndex === -1 && renderAudioPlayer()}
{renderAudioPlayer()}
{exerciseIndex > -1 &&
exerciseIndex < exam.exercises.length &&
!showSolutions &&

View File

@@ -87,6 +87,20 @@ export default function Reading({exam, showSolutions = false, onFinish}: Props)
const [hasExamEnded, setHasExamEnded] = useExamStore((state) => [state.hasExamEnded, state.setHasExamEnded]);
useEffect(() => {
const listener = (e: KeyboardEvent) => {
if (e.key === "F3" || ((e.ctrlKey || e.metaKey) && e.key === "f")) {
e.preventDefault();
}
};
document.addEventListener("keydown", listener);
return () => {
document.removeEventListener("keydown", listener);
};
}, []);
useEffect(() => {
if (hasExamEnded && exerciseIndex === -1) {
setExerciseIndex((prev) => prev + 1);

View File

@@ -27,6 +27,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
snapshot.docs.map((doc) => ({
id: doc.id,
...doc.data(),
module,
})),
),
);