From cc511a48b92f28518b13ef97490f6c226fb768dc Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 21 Oct 2024 17:11:56 +0530 Subject: [PATCH 01/19] #0000 audio detection feature enabled --- src/utils/AudioCompare.js | 65 ++++++++++++++++++++++++++++++-------- src/utils/VoiceAnalyser.js | 2 +- 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/utils/AudioCompare.js b/src/utils/AudioCompare.js index 317eba82..8549ea09 100644 --- a/src/utils/AudioCompare.js +++ b/src/utils/AudioCompare.js @@ -7,9 +7,7 @@ import playButton from "../../src/assets/listen.png"; import pauseButton from "../../src/assets/pause.png"; const AudioRecorder = (props) => { - const [isRecording, setIsRecording] = useState(false); const [status, setStatus] = useState(""); - const [audioBlob, setAudioBlob] = useState(null); const recorderRef = useRef(null); const mediaStreamRef = useRef(null); @@ -45,22 +43,68 @@ const AudioRecorder = (props) => { }); recorderRef.current.startRecording(); - - setIsRecording(true); } catch (err) { console.error("Failed to start recording:", err); } }; - const stopRecording = () => { + const analyzeAudio = async (blob) => { + try { + const audioContext = new (window.AudioContext || + window.webkitAudioContext)(); + const arrayBuffer = await blob.arrayBuffer(); + const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); + + const rawData = audioBuffer.getChannelData(0); // Get audio samples from the first channel + let total = 0; + + // Sum the absolute values of the audio samples + for (let i = 0; i < rawData.length; i++) { + total += Math.abs(rawData[i]); + } + + const average = total / rawData.length; + + // Threshold for silence detection + const silenceThreshold = 0.01; + + if (average < silenceThreshold) { + console.log("The audio contains only silence."); + props.setOpenMessageDialog({ + message: + "Sorry I couldn't hear a voice. Could you please speak again?", + dontShowHeader: true, + }); + return true; + } else { + console.log("The audio contains sound."); + return false; + } + } catch (error) { + console.error("Error analyzing audio:", error); + return true; + } + }; + + const stopRecording = async () => { setStatus("inactive"); if (recorderRef.current) { - recorderRef.current.stopRecording(() => { + recorderRef.current.stopRecording(async () => { const blob = recorderRef.current.getBlob(); if (blob) { - setAudioBlob(blob); - saveBlob(blob); // Persist the blob + const isSilent = await analyzeAudio(blob); + + if (!isSilent) { + saveBlob(blob); + if (props.setEnableNext) { + props.setEnableNext(true); + } + } else { + console.log( + "The recorded audio is empty or silent. Please try again." + ); + } } else { console.error("Failed to retrieve audio blob."); } @@ -69,13 +113,8 @@ const AudioRecorder = (props) => { if (mediaStreamRef.current) { mediaStreamRef.current.getTracks().forEach((track) => track.stop()); } - - setIsRecording(false); }); } - if (props.setEnableNext) { - props.setEnableNext(true); - } }; const saveBlob = (blob) => { diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index a5f78e1f..99d61f97 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -683,7 +683,7 @@ VoiceAnalyser.propTypes = { setIsNextButtonCalled: PropTypes.func, handleNext: PropTypes.func.isRequired, originalText: PropTypes.string, - isShowCase: PropTypes.bool.isRequired, + isShowCase: PropTypes.bool, dontShowListen: PropTypes.bool, setEnableNext: PropTypes.func.isRequired, showOnlyListen: PropTypes.bool, From a56549404c965717fbf8bd7b0631eeb899258cfe Mon Sep 17 00:00:00 2001 From: Gourav More Date: Mon, 21 Oct 2024 17:53:21 +0530 Subject: [PATCH 02/19] Issue #0000 fix: config update for level 5 --- src/utils/constants.js | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/utils/constants.js b/src/utils/constants.js index b2de9576..5337514e 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3360,14 +3360,12 @@ export const levelGetContent = { title: "P3", criteria: "word", template: "simple", - mechanism: { id: "", name: "audio" }, tags: "CEFR_ENG", }, { title: "P4", criteria: "word", template: "simple", - mechanism: { id: "", name: "audio" }, tags: "CEFR_ENG", }, { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, @@ -3377,14 +3375,12 @@ export const levelGetContent = { title: "P7", criteria: "word", template: "simple", - mechanism: { id: "", name: "audio" }, tags: "CEFR_ENG", }, { title: "P8", criteria: "word", template: "simple", - mechanism: { id: "", name: "audio" }, tags: "CEFR_ENG", }, { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, @@ -3422,18 +3418,26 @@ export const levelGetContent = { { title: "S2", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, ], 4: [ - { title: "P1", criteria: "word", template: "simple", competency: "L1.1" }, + { + title: "P1", + criteria: "sentence", + template: "simple", + competency: "L1.1", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, { title: "P2", criteria: "sentence", template: "simple", competency: "L1.2", + mechanism: { id: "", name: "formASentence" }, }, { title: "P3", criteria: "sentence", template: "simple", competency: "L1.1", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, { title: "P4", @@ -3445,42 +3449,43 @@ export const levelGetContent = { title: "S1", criteria: "sentence", template: "simple", + competency: "L1.1, L1.2", mechanism: { id: "mechanic_2", name: "readTheImage" }, - competency: "L1.1,L1.2", }, { title: "P5", criteria: "sentence", template: "simple", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, competency: "L1.2", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, }, { title: "P6", criteria: "sentence", template: "simple", - mechanism: { id: "", name: "FormASentence" }, competency: "L1.1", + mechanism: { id: "", name: "formASentence" }, }, { title: "P7", criteria: "sentence", template: "simple", - mechanism: { id: "mechanic_2", name: "readTheImage" }, competency: "L1.2", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, { title: "P8", criteria: "sentence", template: "simple", competency: "L1.1", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, }, { title: "S2", criteria: "sentence", template: "simple", - mechanism: { id: "mechanic_2", name: "readTheImage" }, competency: "L1.2", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, ], 5: [ @@ -3489,12 +3494,14 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.5", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, }, { title: "P2", criteria: "sentence", template: "simple", competency: "L1.6", + mechanism: { id: "", name: "formASentence" }, }, { title: "P3", @@ -3507,25 +3514,35 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "S1", + criteria: "sentence", + template: "simple", + competency: "L1.5, L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, - { title: "S1", criteria: "sentence", template: "simple" }, { title: "P5", criteria: "sentence", template: "simple", competency: "L1.6", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, }, { title: "P6", criteria: "sentence", template: "simple", competency: "L1.5", + mechanism: { id: "", name: "formASentence" }, }, { title: "P7", criteria: "sentence", template: "simple", competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, { title: "P8", @@ -3538,6 +3555,7 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, }, ], 6: [ From 368d2127ad85a89bf67f4ed17705460e0e3bc08c Mon Sep 17 00:00:00 2001 From: Gourav More Date: Tue, 22 Oct 2024 12:25:57 +0530 Subject: [PATCH 03/19] Issue #0000 fix: form a sentence mechanics not loading Issue #0000 fix: form a sentence mechanics not loading --- src/views/Practice/Practice.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index bcf017bf..7b436aa0 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -953,7 +953,7 @@ const Practice = () => { }} /> ); - } else if (mechanism.name === "FormASentence") { + } else if (mechanism.name === "formASentence") { return ( Date: Tue, 22 Oct 2024 13:15:19 +0530 Subject: [PATCH 04/19] Revert "#0000 audio detection feature enabled" --- src/utils/AudioCompare.js | 65 ++++++++------------------------------ src/utils/VoiceAnalyser.js | 2 +- 2 files changed, 14 insertions(+), 53 deletions(-) diff --git a/src/utils/AudioCompare.js b/src/utils/AudioCompare.js index 8549ea09..317eba82 100644 --- a/src/utils/AudioCompare.js +++ b/src/utils/AudioCompare.js @@ -7,7 +7,9 @@ import playButton from "../../src/assets/listen.png"; import pauseButton from "../../src/assets/pause.png"; const AudioRecorder = (props) => { + const [isRecording, setIsRecording] = useState(false); const [status, setStatus] = useState(""); + const [audioBlob, setAudioBlob] = useState(null); const recorderRef = useRef(null); const mediaStreamRef = useRef(null); @@ -43,68 +45,22 @@ const AudioRecorder = (props) => { }); recorderRef.current.startRecording(); + + setIsRecording(true); } catch (err) { console.error("Failed to start recording:", err); } }; - const analyzeAudio = async (blob) => { - try { - const audioContext = new (window.AudioContext || - window.webkitAudioContext)(); - const arrayBuffer = await blob.arrayBuffer(); - const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); - - const rawData = audioBuffer.getChannelData(0); // Get audio samples from the first channel - let total = 0; - - // Sum the absolute values of the audio samples - for (let i = 0; i < rawData.length; i++) { - total += Math.abs(rawData[i]); - } - - const average = total / rawData.length; - - // Threshold for silence detection - const silenceThreshold = 0.01; - - if (average < silenceThreshold) { - console.log("The audio contains only silence."); - props.setOpenMessageDialog({ - message: - "Sorry I couldn't hear a voice. Could you please speak again?", - dontShowHeader: true, - }); - return true; - } else { - console.log("The audio contains sound."); - return false; - } - } catch (error) { - console.error("Error analyzing audio:", error); - return true; - } - }; - - const stopRecording = async () => { + const stopRecording = () => { setStatus("inactive"); if (recorderRef.current) { - recorderRef.current.stopRecording(async () => { + recorderRef.current.stopRecording(() => { const blob = recorderRef.current.getBlob(); if (blob) { - const isSilent = await analyzeAudio(blob); - - if (!isSilent) { - saveBlob(blob); - if (props.setEnableNext) { - props.setEnableNext(true); - } - } else { - console.log( - "The recorded audio is empty or silent. Please try again." - ); - } + setAudioBlob(blob); + saveBlob(blob); // Persist the blob } else { console.error("Failed to retrieve audio blob."); } @@ -113,8 +69,13 @@ const AudioRecorder = (props) => { if (mediaStreamRef.current) { mediaStreamRef.current.getTracks().forEach((track) => track.stop()); } + + setIsRecording(false); }); } + if (props.setEnableNext) { + props.setEnableNext(true); + } }; const saveBlob = (blob) => { diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index 2acdeada..aef73a3f 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -702,7 +702,7 @@ VoiceAnalyser.propTypes = { setIsNextButtonCalled: PropTypes.func, handleNext: PropTypes.func.isRequired, originalText: PropTypes.string, - isShowCase: PropTypes.bool, + isShowCase: PropTypes.bool.isRequired, dontShowListen: PropTypes.bool, setEnableNext: PropTypes.func.isRequired, showOnlyListen: PropTypes.bool, From cfd6bcd166175a7670aad2a35d3766023305b998 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Wed, 23 Oct 2024 09:13:59 +0530 Subject: [PATCH 05/19] Issueid #229332 fix: audio is mismatching in jumble the word mechanics --- src/utils/constants.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/constants.js b/src/utils/constants.js index 5337514e..b001022d 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3430,7 +3430,7 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.2", - mechanism: { id: "", name: "formASentence" }, + mechanism: { id: "mechanic_3", name: "formASentence" }, }, { title: "P3", @@ -3464,7 +3464,7 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.1", - mechanism: { id: "", name: "formASentence" }, + mechanism: { id: "mechanic_3", name: "formASentence" }, }, { title: "P7", @@ -3501,7 +3501,7 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.6", - mechanism: { id: "", name: "formASentence" }, + mechanism: { id: "mechanic_3", name: "formASentence" }, }, { title: "P3", @@ -3535,7 +3535,7 @@ export const levelGetContent = { criteria: "sentence", template: "simple", competency: "L1.5", - mechanism: { id: "", name: "formASentence" }, + mechanism: { id: "mechanic_3", name: "formASentence" }, }, { title: "P7", From a67102e898740dafe73ef4b616ac7ab0dcc6c91b Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Wed, 23 Oct 2024 12:08:56 +0530 Subject: [PATCH 06/19] Issueid #229352 fix: In Jumble the Sentence Option are going out of screen --- src/components/Practice/Mechanics4.jsx | 44 +++++++++++++++++--------- src/utils/VoiceAnalyser.js | 2 +- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/components/Practice/Mechanics4.jsx b/src/components/Practice/Mechanics4.jsx index 08a1d0f1..5b22c6c0 100644 --- a/src/components/Practice/Mechanics4.jsx +++ b/src/components/Practice/Mechanics4.jsx @@ -1,5 +1,5 @@ import { Box } from "@mui/material"; -import { useEffect, useState } from "react"; +import React, { useEffect, useState } from "react"; import VoiceAnalyser from "../../utils/VoiceAnalyser"; import MainLayout from "../Layouts.jsx/MainLayout"; // import useSound from "use-sound"; @@ -133,7 +133,7 @@ const Mechanics4 = ({ setSelectedWords([...selectedWords, word]); if (selectedWords?.length + 1 === wordsAfterSplit?.length) { let audio = new Audio( - [...selectedWords, word]?.join("") === parentWords + [...selectedWords, word]?.join(" ") === parentWords ? correctSound : wrongSound ); @@ -192,6 +192,7 @@ const Mechanics4 = ({ minHeight: "75px", display: "flex", justifyContent: "center", + flexWrap: "wrap", alignItems: "center", borderRadius: "15px", border: `2px solid ${ @@ -241,7 +242,7 @@ const Mechanics4 = ({ ? "#C30303" : "#333F61", fontWeight: type === "word" ? 600 : 700, - fontSize: "40px", + fontSize: "clamp(1.5rem, 2.5vw, 2.5rem)", fontFamily: "Quicksand", cursor: "pointer", marginLeft: @@ -253,9 +254,16 @@ const Mechanics4 = ({ ))} - + {words?.map((elem) => ( - <> + {type === "word" ? ( handleWords(elem)} @@ -263,20 +271,26 @@ const Mechanics4 = ({ display: "flex", justifyContent: "center", alignItems: "center", - height: "60px", - minWidth: "60px", + height: { xs: "50px", sm: "60px", md: "70px" }, + minWidth: { xs: "50px", sm: "60px", md: "70px" }, background: "#1897DE", - m: 1, + m: { xs: 0.5, sm: 1 }, cursor: "pointer", borderRadius: "12px", border: "5px solid #10618E", + fontSize: { xs: "25px", sm: "30px", md: "35px", lg: "40px" }, }} > @@ -288,22 +302,21 @@ const Mechanics4 = ({ onClick={() => handleWords(elem)} sx={{ textAlign: "center", - px: "25px", - py: "12px", - // background: "transparent", - m: 1, + px: { xs: "15px", sm: "20px", md: "25px" }, + py: { xs: "8px", sm: "10px", md: "12px" }, + m: { xs: 0.5, sm: 1 }, textTransform: "none", borderRadius: "12px", border: `1px solid rgba(51, 63, 97, 0.10)`, background: "#FFF", cursor: "pointer", + fontSize: { xs: "25px", sm: "30px", md: "35px", lg: "40px" }, }} > @@ -311,9 +324,10 @@ const Mechanics4 = ({ )} - + ))} + { Date: Thu, 24 Oct 2024 16:28:29 +0530 Subject: [PATCH 07/19] Issue #0000 fix: config issue fixes --- src/components/Practice/Mechanics3.jsx | 5 + src/utils/VoiceAnalyser.js | 8 +- src/utils/constants.js | 1396 +++++++++++++++++------- src/views/Practice/Practice.jsx | 37 +- 4 files changed, 1063 insertions(+), 383 deletions(-) diff --git a/src/components/Practice/Mechanics3.jsx b/src/components/Practice/Mechanics3.jsx index 76f1756e..a9f0fe42 100644 --- a/src/components/Practice/Mechanics3.jsx +++ b/src/components/Practice/Mechanics3.jsx @@ -16,6 +16,7 @@ import wrongSound from "../../assets/audio/wrong.wav"; import removeSound from "../../assets/audio/remove.wav"; import VoiceAnalyser from "../../utils/VoiceAnalyser"; +// TODO: update it as per File name OR update file name as per export variable name const Mechanics2 = ({ page, setPage, @@ -107,6 +108,8 @@ const Mechanics2 = ({ }, [contentId, parentWords]); const getSimilarWords = async (wordForFindingHomophones) => { + // TODO: needs to pass as prop for mechanics data + const lang = getLocalData("lang"); // const isFillInTheBlanks = type === "fillInTheBlank"; const wordToSimilar = wordForFindingHomophones @@ -201,6 +204,7 @@ const Mechanics2 = ({ setEnableNext(false); }; + // TODO: Constants declaration Need to move up const audioRef = createRef(null); const [duration, setDuration] = useState(0); const [isReady, setIsReady] = React.useState(false); @@ -219,6 +223,7 @@ const Mechanics2 = ({ } }; + // TODO: all the constants declaration Need to move up const [currrentProgress, setCurrrentProgress] = React.useState(0); const progressBarWidth = Number.isNaN(currrentProgress / duration) ? 0 diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index 2acdeada..ab060c5e 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -331,6 +331,9 @@ function VoiceAnalyser(props) { `${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.UPDATE_LEARNER_PROFILE}/${lang}`, requestBody ); + + //TODO: handle Errors + data = updateLearnerData; responseText = data.responseText; profanityWord = await filterBadWords(data.responseText); @@ -492,15 +495,16 @@ function VoiceAnalyser(props) { }; const handlePercentageForLife = ( - percentage, + percentage, // subsessionTargetsCount contentType, - fluencyScore, + fluencyScore, // subsessionFluency language ) => { try { if (livesData) { let totalSyllables = livesData?.totalTargets; if (language === "en") { + // TODO: need to check why this is 50 if (totalSyllables > 50) { totalSyllables = 50; } diff --git a/src/utils/constants.js b/src/utils/constants.js index 5337514e..991ec224 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3329,383 +3329,1025 @@ export const practiceSteps = [ ]; export const levelGetContent = { - 0: [ - { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P3", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P4", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P7", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P8", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - ], - 1: [ - { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P3", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P4", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P7", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P8", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - ], - 2: [ - { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { - title: "P3", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { - title: "P4", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { - title: "P7", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { - title: "P8", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - ], - 3: [ - { - title: "P1", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { - title: "P2", - criteria: "word", - template: "simple", - tags: "CEFR_ENG", - }, - { title: "P3", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - { title: "P4", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - { title: "S1", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - { - title: "P5", - criteria: "sentence", - template: "simple", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "P6", - criteria: "sentence", - template: "simple", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { title: "P7", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - { title: "P8", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - { title: "S2", criteria: "sentence", template: "simple", tags: "CEFR_ENG" }, - ], - 4: [ - { - title: "P1", - criteria: "sentence", - template: "simple", - competency: "L1.1", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.2", - mechanism: { id: "", name: "formASentence" }, - }, - { - title: "P3", - criteria: "sentence", - template: "simple", - competency: "L1.1", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "P4", - criteria: "sentence", - template: "simple", - competency: "L1.2", - }, - { - title: "S1", - criteria: "sentence", - template: "simple", - competency: "L1.1, L1.2", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "P5", - criteria: "sentence", - template: "simple", - competency: "L1.2", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "P6", - criteria: "sentence", - template: "simple", - competency: "L1.1", - mechanism: { id: "", name: "formASentence" }, - }, - { - title: "P7", - criteria: "sentence", - template: "simple", - competency: "L1.2", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "P8", - criteria: "sentence", - template: "simple", - competency: "L1.1", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "S2", - criteria: "sentence", - template: "simple", - competency: "L1.2", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - ], - 5: [ - { - title: "P1", - criteria: "sentence", - template: "simple", - competency: "L1.5", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.6", - mechanism: { id: "", name: "formASentence" }, - }, - { - title: "P3", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "P4", - criteria: "sentence", - template: "simple", - competency: "L1.6", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "S1", - criteria: "sentence", - template: "simple", - competency: "L1.5, L1.6", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "P5", - criteria: "sentence", - template: "simple", - competency: "L1.6", - mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, - }, - { - title: "P6", - criteria: "sentence", - template: "simple", - competency: "L1.5", - mechanism: { id: "", name: "formASentence" }, - }, - { - title: "P7", - criteria: "sentence", - template: "simple", - competency: "L1.6", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - { - title: "P8", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "S2", - criteria: "sentence", - template: "simple", - competency: "L1.6", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - }, - ], - 6: [ - { - title: "P1", - criteria: "sentence", - template: "simple", - competency: "L1.3", - }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.3", - }, - { - title: "P3", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "P4", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "S1", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "P5", - criteria: "sentence", - template: "simple", - competency: "L1.3", - }, - { - title: "P6", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "P7", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "P8", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - { - title: "S2", - criteria: "paragraph", - template: "simple", - competency: "L1.3", - }, - ], - 7: [ - { - title: "P1", - criteria: "sentence", - template: "simple", - competency: "L1.8", - }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.8", - }, - { - title: "P3", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "P4", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "S1", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "P5", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "P6", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "P7", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "P8", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - { - title: "S2", - criteria: "paragraph", - template: "simple", - competency: "L1.8", - }, - ], - 8: [ - { title: "P1", criteria: "sentence", template: "simple" }, - { title: "P2", criteria: "sentence", template: "simple" }, - { title: "P3", criteria: "paragraph", template: "simple" }, - { title: "P4", criteria: "paragraph", template: "simple" }, - { title: "S1", criteria: "paragraph", template: "simple" }, - { title: "P5", criteria: "paragraph", template: "simple" }, - { title: "P6", criteria: "paragraph", template: "simple" }, - { title: "P7", criteria: "paragraph", template: "simple" }, - { title: "P8", criteria: "paragraph", template: "simple" }, - { title: "S2", criteria: "paragraph", template: "simple" }, - ], - 9: [ - { title: "P1", criteria: "sentence", template: "simple" }, - { title: "P2", criteria: "sentence", template: "simple" }, - { title: "P3", criteria: "paragraph", template: "simple" }, - { title: "P4", criteria: "paragraph", template: "simple" }, - { title: "S1", criteria: "paragraph", template: "simple" }, - { title: "P5", criteria: "paragraph", template: "simple" }, - { title: "P6", criteria: "paragraph", template: "simple" }, - { title: "P7", criteria: "paragraph", template: "simple" }, - { title: "P8", criteria: "paragraph", template: "simple" }, - { title: "S2", criteria: "paragraph", template: "simple" }, - ], + en: { + 0: [ + { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P3", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P4", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P7", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P8", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P3", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P4", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P7", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P8", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { + title: "P3", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P4", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { title: "S1", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + { + title: "P7", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P8", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { title: "S2", criteria: "word", template: "simple", tags: "CEFR_ENG" }, + ], + 3: [ + { + title: "P1", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P2", + criteria: "word", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P3", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P4", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "S1", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P5", + criteria: "sentence", + template: "simple", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P6", + criteria: "sentence", + template: "simple", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P7", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "P8", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + { + title: "S2", + criteria: "sentence", + template: "simple", + tags: "CEFR_ENG", + }, + ], + 4: [ + { + title: "P1", + criteria: "sentence", + template: "simple", + competency: "L1.1", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P2", + criteria: "sentence", + template: "simple", + competency: "L1.2", + mechanism: { id: "", name: "formASentence" }, + }, + { + title: "P3", + criteria: "sentence", + template: "simple", + competency: "L1.1", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "P4", + criteria: "sentence", + template: "simple", + competency: "L1.2", + }, + { + title: "S1", + criteria: "sentence", + template: "simple", + competency: "L1.1, L1.2", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "P5", + criteria: "sentence", + template: "simple", + competency: "L1.2", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P6", + criteria: "sentence", + template: "simple", + competency: "L1.1", + mechanism: { id: "", name: "formASentence" }, + }, + { + title: "P7", + criteria: "sentence", + template: "simple", + competency: "L1.2", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "P8", + criteria: "sentence", + template: "simple", + competency: "L1.1", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "S2", + criteria: "sentence", + template: "simple", + competency: "L1.2", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + ], + 5: [ + { + title: "P1", + criteria: "sentence", + template: "simple", + competency: "L1.5", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P2", + criteria: "sentence", + template: "simple", + competency: "L1.6", + mechanism: { id: "", name: "formASentence" }, + }, + { + title: "P3", + criteria: "sentence", + template: "simple", + competency: "L1.5", + }, + { + title: "P4", + criteria: "sentence", + template: "simple", + competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "S1", + criteria: "sentence", + template: "simple", + competency: "L1.5, L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "P5", + criteria: "sentence", + template: "simple", + competency: "L1.6", + mechanism: { id: "mechanic_1", name: "fillInTheBlank" }, + }, + { + title: "P6", + criteria: "sentence", + template: "simple", + competency: "L1.5", + mechanism: { id: "", name: "formASentence" }, + }, + { + title: "P7", + criteria: "sentence", + template: "simple", + competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + { + title: "P8", + criteria: "sentence", + template: "simple", + competency: "L1.5", + }, + { + title: "S2", + criteria: "sentence", + template: "simple", + competency: "L1.6", + mechanism: { id: "mechanic_2", name: "readTheImage" }, + }, + ], + 6: [ + { + title: "P1", + criteria: "sentence", + template: "simple", + competency: "L1.3", + }, + { + title: "P2", + criteria: "sentence", + template: "simple", + competency: "L1.3", + }, + { + title: "P3", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "P4", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "S1", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "P5", + criteria: "sentence", + template: "simple", + competency: "L1.3", + }, + { + title: "P6", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "P7", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "P8", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + { + title: "S2", + criteria: "paragraph", + template: "simple", + competency: "L1.3", + }, + ], + 7: [ + { + title: "P1", + criteria: "sentence", + template: "simple", + competency: "L1.8", + }, + { + title: "P2", + criteria: "sentence", + template: "simple", + competency: "L1.8", + }, + { + title: "P3", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "P4", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "S1", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "P5", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "P6", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "P7", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "P8", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + { + title: "S2", + criteria: "paragraph", + template: "simple", + competency: "L1.8", + }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, + ta: { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, + hi: { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, + kn: { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, + te: { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, + gu: { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + }, }; export function callConfettiSnow() { diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index bcf017bf..17fe8054 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -38,7 +38,7 @@ const Practice = () => { const [questions, setQuestions] = useState([]); const [enableNext, setEnableNext] = useState(false); const [progressData, setProgressData] = useState({}); - const [level, setLevel] = useState(""); + const [level, setLevel] = useState(0); const [isShowCase, setIsShowCase] = useState(false); const [startShowCase, setStartShowCase] = useState(false); const limit = 5; @@ -215,7 +215,9 @@ const Practice = () => { let newQuestionIndex = currentQuestion === questions.length - 1 ? 0 : currentQuestion + 1; - const currentGetContent = levelGetContent?.[level]?.find( + const currentGetContent = levelGetContent[ + localStorage.getItem("lang") || "en" + ]?.[level]?.find( (elem) => elem.title === practiceSteps?.[newPracticeStep]?.name ); @@ -319,6 +321,8 @@ const Practice = () => { (currentGetContent?.tags ? `&tags=${currentGetContent?.tags}` : "") ); + //TODO: required only for S1 and S2 + setTotalSyllableCount(resGetContent?.data?.totalSyllableCount); setLivesData({ ...livesData, @@ -334,11 +338,17 @@ const Practice = () => { currentPracticeStep === 3 || currentPracticeStep === 8; setIsShowCase(showcaseLevel); + // TODO: API returns contents if 200 status quesArr = [...quesArr, ...(resGetContent?.data?.content || [])]; setCurrentContentType(resGetContent?.data?.content?.[0]?.contentType); setCurrentCollectionId(resGetContent?.data?.content?.[0]?.collectionId); + + // TODO: not required - not using this anywhere setAssessmentResponse(resGetContent); + setCurrentQuestion(0); + + // TODO: not required - we are geting this data from API practiceProgress[virtualId] = { currentQuestion: newQuestionIndex, currentPracticeProgress, @@ -349,11 +359,14 @@ const Practice = () => { localStorage.setItem("storyTitle", resGetContent?.name); setQuestions(quesArr); + + // TODO: needs to revisit this logic setTimeout(() => { setMechanism(currentGetContent.mechanism); }, 1000); } else if (currentQuestion < questions.length - 1) { setCurrentQuestion(currentQuestion + 1); + practiceProgress[virtualId] = { currentQuestion: newQuestionIndex, currentPracticeProgress, @@ -412,6 +425,9 @@ const Practice = () => { const getMilestoneDetails = await axios.get( `${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${lang}` ); + + // TODO: validate the getMilestoneDetails API return + setLocalData( "getMilestone", JSON.stringify({ ...getMilestoneDetails.data }) @@ -427,9 +443,14 @@ const Practice = () => { const resLessons = await axios.get( `${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_LESSON_PROGRESS_BY_ID}/${virtualId}?language=${lang}` ); + + // TODO: Handle Error for lessons - no lesson progress - starting point should be P1 + const getPointersDetails = await axios.get( `${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}` ); + + // TODO: Just Opss icon - we are trying to fetch the score for you setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0); let userState = Number.isInteger( @@ -438,6 +459,7 @@ const Practice = () => { ? Number(resLessons.data?.result?.result?.lesson) : 0; + // TODO: revisit this - looks like not required let practiceProgress = getLocalData("practiceProgress"); practiceProgress = practiceProgress ? JSON.parse(practiceProgress) : {}; @@ -447,7 +469,9 @@ const Practice = () => { currentPracticeStep: userState || 0, }; - const currentGetContent = levelGetContent?.[level]?.find( + const currentGetContent = levelGetContent[ + localStorage.getItem("lang") || "en" + ]?.[level]?.find( (elem) => elem.title === practiceSteps?.[userState].name ); @@ -461,6 +485,9 @@ const Practice = () => { : "") + (currentGetContent?.tags ? `&tags=${currentGetContent?.tags}` : "") ); + + // TODO: handle error if resWord is empty + setTotalSyllableCount(resWord?.data?.totalSyllableCount); setLivesData({ ...livesData, @@ -545,7 +572,9 @@ const Practice = () => { setProgressData(practiceProgress[virtualId]); - const currentGetContent = levelGetContent?.[level]?.find( + const currentGetContent = levelGetContent[ + localStorage.getItem("lang") || "en" + ]?.[level]?.find( (elem) => elem.title === practiceSteps?.[newCurrentPracticeStep].name ); let quesArr = []; From d58d1144120d9ee9adb99fa5ef5977cfe3b5a460 Mon Sep 17 00:00:00 2001 From: Gourav More Date: Fri, 25 Oct 2024 10:32:10 +0530 Subject: [PATCH 08/19] Issue #new env for tn --- .github/workflows/all-dev-tn-new.yml | 95 ++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/all-dev-tn-new.yml diff --git a/.github/workflows/all-dev-tn-new.yml b/.github/workflows/all-dev-tn-new.yml new file mode 100644 index 00000000..481aff75 --- /dev/null +++ b/.github/workflows/all-dev-tn-new.yml @@ -0,0 +1,95 @@ +name: ALL tn new dev Deployment + +on: + push: + branches: + - all-1.3-tn-dev + +jobs: + deploy: + runs-on: ubuntu-latest + environment: all-dev-tn + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Clean up node_modules and package-lock.json + run: | + rm -rf node_modules + rm -f package-lock.json + + - name: Install Dependencies + run: npm install --legacy-peer-deps + + - name: Run Husky Install + run: npm run prepare + + - name: Build and Package Application + env: + SKIP_PREFLIGHT_CHECK: ${{ vars.SKIP_PREFLIGHT_CHECK }} + REACT_APP_MODE: ${{ vars.REACT_APP_MODE }} + REACT_APP_authToken: ${{ vars.REACT_APP_authToken }} + REACT_APP_PID: ${{ vars.REACT_APP_PID }} + REACT_APP_UID: ${{ vars.REACT_APP_UID }} + REACT_APP_ID: ${{ vars.REACT_APP_ID }} + REACT_APP_VER: ${{ vars.REACT_APP_VER }} + REACT_APP_TIMEDIFF: ${{ vars.REACT_APP_TIMEDIFF }} + REACT_APP_HOST: ${{ vars.REACT_APP_HOST }} + REACT_APP_ENDPOINT: ${{ vars.REACT_APP_ENDPOINT }} + REACT_APP_APISLUG: ${{ vars.REACT_APP_APISLUG }} + REACT_APP_CHANNEL: ${{ vars.REACT_APP_CHANNEL }} + REACT_APP_ENV: ${{ vars.REACT_APP_ENV }} + REACT_APP_BATCHSIZE: ${{ vars.REACT_APP_BATCHSIZE }} + REACT_APP_CONTENT_SIZE: ${{ vars.REACT_APP_CONTENT_SIZE }} + REACT_APP_LANGUAGE: ${{ vars.REACT_APP_LANGUAGE }} + REACT_APP_TELEMETRY_MODE: ${{ vars.REACT_APP_TELEMETRY_MODE }} + REACT_APP_VIRTUAL_ID_HOST: ${{ vars.REACT_APP_VIRTUAL_ID_HOST }} + REACT_APP_LEARNER_AI_ORCHESTRATION_HOST: ${{ vars.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST }} + REACT_APP_LEARNER_AI_APP_HOST: ${{ vars.REACT_APP_LEARNER_AI_APP_HOST }} + REACT_APP_CONTENT_SERVICE_APP_HOST: ${{ vars.REACT_APP_CONTENT_SERVICE_APP_HOST }} + REACT_APP_CAPTURE_AUDIO: ${{ vars.REACT_APP_CAPTURE_AUDIO }} + REACT_APP_AWS_S3_BUCKET_NAME: ${{ vars.REACT_APP_AWS_S3_BUCKET_NAME }} + REACT_APP_AWS_S3_BUCKET_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_URL }} + REACT_APP_AWS_S3_REGION: ${{ vars.REACT_APP_AWS_S3_REGION }} + REACT_APP_AWS_S3_BUCKET_CONTENT_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_CONTENT_URL }} + REACT_APP_MIN_DECIBELS: ${{ vars.REACT_APP_MIN_DECIBELS }} + REACT_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }} + REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} + REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} + REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} + REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }} + REACT_APP_AWS_ACCESS_KEY_ID: ${{ secrets.REACT_APP_AWS_ACCESS_KEY_ID }} + REACT_APP_AWS_SECRET_ACCESS_KEY: ${{ secrets.REACT_APP_AWS_SECRET_ACCESS_KEY }} + CI: false # Disabling CI to not treat warnings as errors + run: npm run build + + - name: Deploy to S3 Bucket + run: aws s3 sync ./build s3://all-tn-app-dev/assets/test-rig/ + + - name: Debug Environment Variables + run: | + echo "REACT_APP_AWS_S3_BUCKET_NAME: $REACT_APP_AWS_S3_BUCKET_NAME" + echo "AWS_REGION: $AWS_REGION" + echo "secrate": ${{ vars.REACT_APP_AWS_S3_BUCKET_NAME }} + + - name: Cloudfront Invalidation + uses: chetan/invalidate-cloudfront-action@master + env: + DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_NEW }} + PATHS: "/*" + AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 25d5f03d42ea9352cc641b60cf87db24fce974ac Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Fri, 25 Oct 2024 12:35:08 +0530 Subject: [PATCH 09/19] Issueid #0000 iframe height for fill in the blanks --- src/views/Practice/Practice.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index 7b436aa0..4feabc65 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -716,9 +716,10 @@ const Practice = () => { questions[currentQuestion]?.contentSourceData || []; const stringLengths = contentSourceData.map((item) => item.text.length); const length = - questions[currentQuestion]?.mechanics_data && - questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_2" + (questions[currentQuestion]?.mechanics_data && + questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_2") || + "mechanic_1" ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); From 9ad5e06183cd9fded84d54349ae43b2df1db0603 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Fri, 25 Oct 2024 12:46:45 +0530 Subject: [PATCH 10/19] Issueid #0000 iframe height for fill in the blanks --- src/views/Practice/Practice.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index 4feabc65..5fd15360 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -719,7 +719,8 @@ const Practice = () => { (questions[currentQuestion]?.mechanics_data && questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === "mechanic_2") || - "mechanic_1" + questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_1" ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); From b9d2a5eed9c1fa12c0f5b9bbe66434104a31a3dd Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 28 Oct 2024 09:25:09 +0530 Subject: [PATCH 11/19] Issueid #0000 iframe height for fill in the blanks --- src/views/Practice/Practice.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index 5fd15360..a2bfe855 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -716,11 +716,11 @@ const Practice = () => { questions[currentQuestion]?.contentSourceData || []; const stringLengths = contentSourceData.map((item) => item.text.length); const length = - (questions[currentQuestion]?.mechanics_data && + questions[currentQuestion]?.mechanics_data && + (questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_2" || questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_2") || - questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_1" + "mechanic_1") ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); From 5840456d09b026718fb8723e63a685559f4e4e7d Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 28 Oct 2024 12:30:40 +0530 Subject: [PATCH 12/19] Issueid #229204 fix: Even after speaking correct word,showing wrong answer on result page. PFA --- src/utils/VoiceAnalyser.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index e3bc3d02..9d7260d4 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -501,6 +501,15 @@ function VoiceAnalyser(props) { ); setApiResponse(callUpdateLearner ? data.status : "success"); + + if ( + callUpdateLearner && + (props.pageName === "wordsorimage" || props.pageName === "m5") + ) { + const isMatching = + responseText.toLowerCase() === originalText.toLowerCase(); + props.updateStoredData(recordedAudio, isMatching); + } if (props.handleNext) { props.handleNext(); if (temp_audio !== null) { @@ -712,12 +721,6 @@ function VoiceAnalyser(props) { { - if ( - props.pageName === "wordsorimage" || - props.pageName === "m5" - ) { - props.updateStoredData(recordedAudio, isMatching); - } if (props.setIsNextButtonCalled) { props.setIsNextButtonCalled(true); } else { From 32204f19002050fe3f4686443ead4e46ee0d1942 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 28 Oct 2024 16:31:03 +0530 Subject: [PATCH 13/19] Issueid #229204 fix: Even after speaking correct word,showing wrong answer on result page. PFA --- src/utils/VoiceAnalyser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index 9d7260d4..ca9fa094 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -507,8 +507,10 @@ function VoiceAnalyser(props) { (props.pageName === "wordsorimage" || props.pageName === "m5") ) { const isMatching = - responseText.toLowerCase() === originalText.toLowerCase(); - props.updateStoredData(recordedAudio, isMatching); + data?.createScoreData?.session?.error_rate?.character === 0; + if (typeof props.updateStoredData === "function") { + props.updateStoredData(recordedAudio, isMatching); + } } if (props.handleNext) { props.handleNext(); From 509afdfe485a7fa8ca24acbb88938fcc676b299b Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 28 Oct 2024 18:09:56 +0530 Subject: [PATCH 14/19] Issueid #229204 fix: Even after speaking correct word,showing wrong answer on result page. PFA --- src/views/Practice/Practice.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index a2bfe855..5fd15360 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -716,11 +716,11 @@ const Practice = () => { questions[currentQuestion]?.contentSourceData || []; const stringLengths = contentSourceData.map((item) => item.text.length); const length = - questions[currentQuestion]?.mechanics_data && - (questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_2" || + (questions[currentQuestion]?.mechanics_data && questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_1") + "mechanic_2") || + questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_1" ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); From 231bf2613edb5f0f06a4881a5e527f07021da412 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Tue, 29 Oct 2024 15:08:26 +0530 Subject: [PATCH 15/19] Issueid #0000 iframe height for fill in the blanks --- src/views/Practice/Practice.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/Practice/Practice.jsx b/src/views/Practice/Practice.jsx index 5fd15360..a2bfe855 100644 --- a/src/views/Practice/Practice.jsx +++ b/src/views/Practice/Practice.jsx @@ -716,11 +716,11 @@ const Practice = () => { questions[currentQuestion]?.contentSourceData || []; const stringLengths = contentSourceData.map((item) => item.text.length); const length = - (questions[currentQuestion]?.mechanics_data && + questions[currentQuestion]?.mechanics_data && + (questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_2" || questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_2") || - questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === - "mechanic_1" + "mechanic_1") ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); From 415f5b229ddf91bb3c29a84da2a3d8fd4bf63212 Mon Sep 17 00:00:00 2001 From: Gourav More Date: Wed, 30 Oct 2024 11:34:03 +0530 Subject: [PATCH 16/19] Issue #zoomicon changes for images --- src/components/Practice/Mechanics5.jsx | 104 +++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 6 deletions(-) diff --git a/src/components/Practice/Mechanics5.jsx b/src/components/Practice/Mechanics5.jsx index 1a1f8dd7..c08d93cd 100644 --- a/src/components/Practice/Mechanics5.jsx +++ b/src/components/Practice/Mechanics5.jsx @@ -4,6 +4,9 @@ import MainLayout from "../Layouts.jsx/MainLayout"; import { PlayAudioButton, StopAudioButton } from "../../utils/constants"; import VoiceAnalyser from "../../utils/VoiceAnalyser"; import PropTypes from "prop-types"; +import { Modal } from "@mui/material"; +import ZoomInIcon from "@mui/icons-material/ZoomIn"; +import CloseIcon from "@mui/icons-material/Close"; const Mechanics5 = ({ background, @@ -54,6 +57,7 @@ const Mechanics5 = ({ const audiosRef = useRef( new Array(options.length).fill(null).map(() => React.createRef()) ); + const [zoomOpen, setZoomOpen] = useState(false); const questionAudioRef = useRef(); const [playingIndex, setPlayingIndex] = useState(null); const [selectedOption, setSelectedOption] = useState(null); // Add state to track selected radio button @@ -179,13 +183,101 @@ const Mechanics5 = ({ container sx={{ width: "80%", justifyContent: "center", mb: 2, mt: 8 }} > - - + + {/* Image with full-width gradient overlay on top */} + + contentImage setZoomOpen(true)} // Open modal on click + /> + + {/* Subtle gradient overlay across the top */} + + {/* Zoom icon positioned in the top-left corner */} + setZoomOpen(true)} + sx={{ color: "white", fontSize: "22px", cursor: "pointer" }} + /> + + + + {/* Modal for zoomed image with gradient and close icon */} + setZoomOpen(false)} + sx={{ + display: "flex", + alignItems: "center", + justifyContent: "center", + }} + > + + {/* Subtle gradient overlay at the top of the zoomed image */} + + {/* Close icon positioned within the gradient overlay */} + setZoomOpen(false)} + sx={{ + color: "white", + fontSize: "24px", + cursor: "pointer", + backgroundColor: "rgba(0, 0, 0, 0.5)", + borderRadius: "50%", + padding: "4px", + }} + /> + + + Zoomed content + + + + setZoomOpen(false)} + sx={{ + display: "flex", + alignItems: "center", + justifyContent: "center", + }} + > + + {/* Subtle gradient overlay at the top of the zoomed image */} + + {/* Close icon positioned within the gradient overlay */} + setZoomOpen(false)} + sx={{ + color: "white", + fontSize: "24px", + cursor: "pointer", + backgroundColor: "rgba(0, 0, 0, 0.5)", + borderRadius: "50%", + padding: "4px", + }} + /> + + + Zoomed content + + Date: Mon, 4 Nov 2024 15:35:53 +0530 Subject: [PATCH 18/19] Issueid #0000 feat: zoom in and out feature enable for fillintheblanks --- src/components/Practice/Mechanics3.jsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Practice/Mechanics3.jsx b/src/components/Practice/Mechanics3.jsx index c29a6c1a..4d454533 100644 --- a/src/components/Practice/Mechanics3.jsx +++ b/src/components/Practice/Mechanics3.jsx @@ -304,7 +304,14 @@ const Mechanics2 = ({ justifyContent: "center", }} > - + {/* Subtle gradient overlay at the top of the zoomed image */} From 1366313c9b3b4bfb3ebf334d514b8cc70651c171 Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Mon, 4 Nov 2024 16:16:47 +0530 Subject: [PATCH 19/19] Issueid #0000 feat: zoom in and out feature enable for fillintheblanks --- src/components/Practice/Mechanics3.jsx | 1 + src/components/Practice/Mechanics5.jsx | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/Practice/Mechanics3.jsx b/src/components/Practice/Mechanics3.jsx index 4d454533..8bc563dd 100644 --- a/src/components/Practice/Mechanics3.jsx +++ b/src/components/Practice/Mechanics3.jsx @@ -261,6 +261,7 @@ const Mechanics2 = ({ {image && ( setZoomOpen(true)} src={image} style={{ borderRadius: "20px", diff --git a/src/components/Practice/Mechanics5.jsx b/src/components/Practice/Mechanics5.jsx index c08d93cd..76121f04 100644 --- a/src/components/Practice/Mechanics5.jsx +++ b/src/components/Practice/Mechanics5.jsx @@ -232,7 +232,14 @@ const Mechanics5 = ({ justifyContent: "center", }} > - + {/* Subtle gradient overlay at the top of the zoomed image */}