diff --git a/.github/workflows/all-dev-tn-new.yml b/.github/workflows/all-dev-tn-new.yml new file mode 100644 index 0000000..481aff7 --- /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 }} diff --git a/src/components/Practice/Mechanics3.jsx b/src/components/Practice/Mechanics3.jsx index 76f1756..1d26fcc 100644 --- a/src/components/Practice/Mechanics3.jsx +++ b/src/components/Practice/Mechanics3.jsx @@ -15,7 +15,11 @@ import correctSound from "../../assets/audio/correct.wav"; import wrongSound from "../../assets/audio/wrong.wav"; import removeSound from "../../assets/audio/remove.wav"; import VoiceAnalyser from "../../utils/VoiceAnalyser"; +import { Modal } from "@mui/material"; +import ZoomInIcon from "@mui/icons-material/ZoomIn"; +import CloseIcon from "@mui/icons-material/Close"; +// TODO: update it as per File name OR update file name as per export variable name const Mechanics2 = ({ page, setPage, @@ -54,7 +58,7 @@ const Mechanics2 = ({ }) => { const [words, setWords] = useState([]); const [sentences, setSentences] = useState([]); - + const [zoomOpen, setZoomOpen] = useState(false); const [selectedWord, setSelectedWord] = useState(""); // const [loading, setLoading] = useState(false); const [shake, setShake] = useState(false); @@ -68,111 +72,9 @@ const Mechanics2 = ({ }); const lang = getLocalData("lang"); - let wordToCheck = type === "audio" ? parentWords : wordToFill; //console.log('Mechanics3', answer); - useEffect(() => { - const initializeFillInTheBlank = async () => { - if (type === "fillInTheBlank" && parentWords?.length) { - let wordsArr = parentWords.split(" "); - let randomIndex = Math.floor(Math.random() * wordsArr.length); - try { - await getSimilarWords(wordsArr[randomIndex]); - setWordToFill(wordsArr[randomIndex]); - // wordsArr[randomIndex] = "dash"; - setSentences(wordsArr); - setSelectedWord(""); - } catch (error) { - console.error("Error in initializeFillInTheBlank:", error); - } - } - }; - initializeFillInTheBlank(); - }, [contentId, parentWords]); - - useEffect(() => { - const initializeAudio = async () => { - if (type === "audio" && parentWords) { - setDisabledWords(true); - setSelectedWord(""); - try { - await getSimilarWords(parentWords); - } catch (error) { - console.error("Error in initializeAudio:", error); - } - } - }; - initializeAudio(); - }, [contentId, parentWords]); - - const getSimilarWords = async (wordForFindingHomophones) => { - const lang = getLocalData("lang"); - // const isFillInTheBlanks = type === "fillInTheBlank"; - const wordToSimilar = wordForFindingHomophones - ? wordForFindingHomophones - : parentWords; - - if (lang === "en") { - const finder = new HomophonesFinder(); - const homophones = await finder.find(wordToSimilar); - let wordsArr = [homophones[8], wordToSimilar, homophones[6]]; - setWords(randomizeArray(wordsArr)); - } else { - let wordsToShow = []; - if (type == "audio") { - wordsToShow = allWords?.filter((elem) => elem != wordToSimilar); - } - if (type == "fillInTheBlank") { - wordsToShow = allWords - ?.join(" ") - ?.split(" ") - .filter((elem) => elem !== wordToSimilar && elem.length > 2); - } - - wordsToShow = randomizeArray(wordsToShow).slice(0, 2); - wordsToShow.push(wordToSimilar); - setWords(randomizeArray(wordsToShow)); - } - }; - - const handleWord = (word, removeWord) => { - if (removeWord) { - setWords([...words, word]); - setSelectedWord(""); - setEnableNext(false); - } else { - let wordsArr = [...words]; - - if (type !== "audio") { - let index = wordsArr?.findIndex((elem) => elem === word); - if (index !== -1) { - wordsArr?.splice(index, 1); - } - } - - if (selectedWord && type !== "audio") { - wordsArr.push(selectedWord); - } - - // if (type === "audio") { - const isSoundCorrect = word === wordToCheck; - let audio = new Audio(isSoundCorrect ? correctSound : wrongSound); - if (!isSoundCorrect) { - setEnableNext(false); - } - audio.play(); - setShake(true); - setTimeout(() => { - setShake(false); - }, 800); - // } - - setWords(wordsArr); - setSelectedWord(word); - } - }; - useEffect(() => { if (!enableNext) { setAnswer({ text: "", audio_url: "", image_url: "", isAns: false }); @@ -201,6 +103,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,25 +122,17 @@ const Mechanics2 = ({ } }; + // TODO: all the constants declaration Need to move up const [currrentProgress, setCurrrentProgress] = React.useState(0); const progressBarWidth = Number.isNaN(currrentProgress / duration) ? 0 : currrentProgress / duration; - const getEnableButton = () => { - if (type === "fillInTheBlank") { - return enableNext; - } - if (type === "audio") { - return selectedWord === wordToCheck; - } - return false; - }; return ( <MainLayout background={background} handleNext={handleNext} - enableNext={getEnableButton()} + enableNext={enableNext} showTimer={showTimer} points={points} pageName={"m3"} @@ -354,38 +249,126 @@ const Mechanics2 = ({ xs: "relative", // For extra small screens sm: "relative", // For small screens md: "relative", // For medium screens - lg: "absolute", // Change as needed for large screens - xl: "absolute", // Change as needed for extra-large screens + lg: "relative", // Change as needed for large screens + xl: "relative", // Change as needed for extra-large screens }, left: { xs: 0, // For extra small screens sm: 0, // For small screens md: "-40px", // Adjust position for medium screens - lg: "40px", - }, - mt: { - lg: "300px", + lg: "0px", + xl: "0px", }, }} > - {image && ( - <img - src={image} - style={{ - borderRadius: "20px", - maxWidth: "100%", - height: "250px", + <Box sx={{ position: "relative", cursor: "zoom-in" }}> + {image && ( + <img + onClick={() => setZoomOpen(true)} + src={image} + style={{ + borderRadius: "20px", + maxWidth: "100%", + height: "clamp(150px, 20vw, 220px)", + }} + alt="" + /> + )} + + {/* Subtle gradient overlay across the top */} + <Box + sx={{ + position: "absolute", + top: 0, + left: 0, + right: 0, + height: "40px", // Height of the gradient overlay + background: + "linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent)", + borderTopLeftRadius: "20px", + borderTopRightRadius: "20px", + display: "flex", + alignItems: "center", + paddingLeft: "8px", }} - alt="" - /> - )} + > + {/* Zoom icon positioned in the top-left corner */} + <ZoomInIcon + onClick={() => setZoomOpen(true)} + sx={{ color: "white", fontSize: "22px", cursor: "pointer" }} + /> + </Box> + </Box> + <Modal + open={zoomOpen} + onClose={() => setZoomOpen(false)} + sx={{ + display: "flex", + alignItems: "center", + justifyContent: "center", + }} + > + <Box + sx={{ + position: "relative", + outline: "none", + height: "500px", + width: "500px", + }} + > + {/* Subtle gradient overlay at the top of the zoomed image */} + <Box + sx={{ + position: "absolute", + top: 0, + left: 0, + right: 0, + height: "40px", // Adjust height as needed + background: + "linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent)", + display: "flex", + alignItems: "center", + justifyContent: "flex-end", + paddingRight: "8px", + borderTopLeftRadius: "8px", + borderTopRightRadius: "8px", + }} + > + {/* Close icon positioned within the gradient overlay */} + <CloseIcon + onClick={() => setZoomOpen(false)} + sx={{ + color: "white", + fontSize: "24px", + cursor: "pointer", + backgroundColor: "rgba(0, 0, 0, 0.5)", + borderRadius: "50%", + padding: "4px", + }} + /> + </Box> + + <img + src={image} + alt="Zoomed content" + style={{ + // maxWidth: "90vw", + // maxHeight: "90vh", + // height:"500px", + width: "100%", + borderRadius: "8px", + }} + /> + </Box> + </Modal> </Grid> <Box sx={{ display: "flex", justifyContent: "center", - mt: { xs: "20px", sm: "40px" }, // Add margin-top to create space below the image + mt: { xs: "20px", sm: "40px" }, + width: "75%", }} > <Typography @@ -402,7 +385,7 @@ const Mechanics2 = ({ > {answer?.text !== "" ? ( <> - {parentWords?.split("_____")[0]} {/* Before the blank */} + {parentWords?.split(/_+/)[0]} <span className={!answer.isAns && shake ? "shakeImage" : ""} style={{ @@ -422,7 +405,7 @@ const Mechanics2 = ({ > {answer?.text} </span> - {parentWords?.split("_____")[1]} {/* After the blank */} + {parentWords?.split(/_+/)[1]} </> ) : ( <>{parentWords}</> @@ -438,52 +421,9 @@ const Mechanics2 = ({ justifyContent: "center", marginTop: "20px", marginBottom: "30px", + flexWrap: "wrap", }} > - {type === "audio" && - words?.map((elem, ind) => ( - <Box - key={ind} - className={`${ - type === "audio" && selectedWord === elem - ? selectedWord === parentWords - ? `audioSelectedWord` - : `audioSelectedWrongWord ${shake ? "shakeImage" : ""}` - : "" - }`} - onClick={() => handleWord(elem)} - sx={{ - textAlign: "center", - px: "25px", - py: "12px", - // background: "transparent", - m: 1, - textTransform: "none", - borderRadius: "12px", - border: `1px solid rgba(51, 63, 97, 0.10)`, - background: "#FFF", - cursor: "pointer", - opacity: disabledWords ? 0.25 : 1, - pointerEvents: disabledWords ? "none" : "initial", - }} - > - <span - style={{ - color: - type === "audio" && selectedWord === elem - ? selectedWord === parentWords - ? "#58CC02" - : "#C30303" - : "#333F61", - fontWeight: 600, - fontSize: "32px", - fontFamily: "Quicksand", - }} - > - {elem} - </span> - </Box> - ))} <> {type === "fillInTheBlank" && Array.isArray(options) && @@ -550,7 +490,7 @@ const Mechanics2 = ({ dontShowListen={type === "image" || isDiscover} // updateStory={updateStory} originalText={parentWords} - enableNext={getEnableButton()} + enableNext={enableNext} handleNext={handleNext} audioLink={audio ? audio : null} {...{ diff --git a/src/components/Practice/Mechanics4.jsx b/src/components/Practice/Mechanics4.jsx index 08a1d0f..5b22c6c 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 = ({ ))} </Box> </Box> - <Box sx={{ display: "flex", justifyContent: "center", mb: 3 }}> + <Box + sx={{ + display: "flex", + justifyContent: "center", + flexWrap: "wrap", + mb: 3, + }} + > {words?.map((elem) => ( - <> + <React.Fragment key={elem}> {type === "word" ? ( <Box onClick={() => 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" }, }} > <span style={{ color: "white", fontWeight: 600, - fontSize: "40px", + fontSize: { + xs: "25px", + sm: "35px", + md: "40px", + lg: "40px", + }, fontFamily: "Quicksand", }} > @@ -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" }, }} > <span style={{ color: "#6F80B1", fontWeight: 600, - fontSize: "32px", fontFamily: "Quicksand", }} > @@ -311,9 +324,10 @@ const Mechanics4 = ({ </span> </Box> )} - </> + </React.Fragment> ))} </Box> + { <Box sx={{ display: "flex", justifyContent: "center" }}> <VoiceAnalyser diff --git a/src/components/Practice/Mechanics5.jsx b/src/components/Practice/Mechanics5.jsx index 1a1f8dd..76121f0 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,109 @@ const Mechanics5 = ({ container sx={{ width: "80%", justifyContent: "center", mb: 2, mt: 8 }} > - <Grid item xs={4}> - <img - src={image} - style={{ borderRadius: "20px", maxWidth: "100%", height: "250px" }} - alt="" - /> + <Grid item xs={4} position="relative"> + {/* Image with full-width gradient overlay on top */} + <Box sx={{ position: "relative", cursor: "zoom-in" }}> + <img + src={image} + style={{ + borderRadius: "20px", + maxWidth: "100%", + height: "250px", + }} + alt="contentImage" + onClick={() => setZoomOpen(true)} // Open modal on click + /> + + {/* Subtle gradient overlay across the top */} + <Box + sx={{ + position: "absolute", + top: 0, + left: 0, + right: 0, + height: "40px", // Height of the gradient overlay + background: + "linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent)", + borderTopLeftRadius: "20px", + borderTopRightRadius: "20px", + display: "flex", + alignItems: "center", + paddingLeft: "8px", + }} + > + {/* Zoom icon positioned in the top-left corner */} + <ZoomInIcon + onClick={() => setZoomOpen(true)} + sx={{ color: "white", fontSize: "22px", cursor: "pointer" }} + /> + </Box> + </Box> + + {/* Modal for zoomed image with gradient and close icon */} + <Modal + open={zoomOpen} + onClose={() => setZoomOpen(false)} + sx={{ + display: "flex", + alignItems: "center", + justifyContent: "center", + }} + > + <Box + sx={{ + position: "relative", + outline: "none", + height: "500px", + width: "500px", + }} + > + {/* Subtle gradient overlay at the top of the zoomed image */} + <Box + sx={{ + position: "absolute", + top: 0, + left: 0, + right: 0, + height: "40px", // Adjust height as needed + background: + "linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent)", + display: "flex", + alignItems: "center", + justifyContent: "flex-end", + paddingRight: "8px", + borderTopLeftRadius: "8px", + borderTopRightRadius: "8px", + }} + > + {/* Close icon positioned within the gradient overlay */} + <CloseIcon + onClick={() => setZoomOpen(false)} + sx={{ + color: "white", + fontSize: "24px", + cursor: "pointer", + backgroundColor: "rgba(0, 0, 0, 0.5)", + borderRadius: "50%", + padding: "4px", + }} + /> + </Box> + + <img + src={image} + alt="Zoomed content" + style={{ + // maxWidth: "90vw", + // maxHeight: "90vh", + width: "100%", + borderRadius: "8px", + }} + /> + </Box> + </Modal> </Grid> + <Grid item xs={8} paddingLeft={2}> <Box paddingBottom={3} sx={{ display: "flex" }}> <audio diff --git a/src/utils/AudioCompare.js b/src/utils/AudioCompare.js index 317eba8..a81b3ac 100644 --- a/src/utils/AudioCompare.js +++ b/src/utils/AudioCompare.js @@ -149,6 +149,7 @@ const AudioRecorder = (props) => { <Box sx={{ marginLeft: props.isShowCase ? "" : "35px", + cursor: "pointer", }} > {props.recordedAudio ? ( diff --git a/src/utils/VoiceAnalyser.js b/src/utils/VoiceAnalyser.js index aef73a3..1884ab4 100644 --- a/src/utils/VoiceAnalyser.js +++ b/src/utils/VoiceAnalyser.js @@ -68,6 +68,7 @@ function VoiceAnalyser(props) { const [currentIndex, setCurrentIndex] = useState(); const [temp_audio, set_temp_audio] = useState(null); const [isStudentAudioPlaying, setIsStudentAudioPlaying] = useState(false); + const [temp_Student_audio, set_temp_Student_audio] = useState(null); const { callUpdateLearner } = props; const lang = getLocalData("lang"); const { livesData, setLivesData } = props; @@ -107,7 +108,11 @@ function VoiceAnalyser(props) { audio.addEventListener("canplaythrough", () => { set_temp_audio(audio); setPauseAudio(val); - audio.play(); + if (val) { + audio.play(); + } else { + audio.pause(); + } }); audio.addEventListener("error", (e) => { @@ -127,20 +132,50 @@ function VoiceAnalyser(props) { } try { const audio = new Audio(recordedAudio); - - if (val) { - audio.play(); - setIsStudentAudioPlaying(true); - audio.onended = () => setIsStudentAudioPlaying(false); - } else { - audio.pause(); + audio.addEventListener("canplaythrough", () => { + setIsStudentAudioPlaying(val); + set_temp_Student_audio(audio); + if (val) { + audio.play(); + audio.onended = () => setIsStudentAudioPlaying(false); + } else { + audio.pause(); + } + }); + audio.addEventListener("error", (e) => { + console.error("Audio failed to load", e); setIsStudentAudioPlaying(false); - } + alert("Failed to load the audio. Please try again."); + }); } catch (err) { console.log(err); } }; + useEffect(() => { + if (temp_Student_audio !== null) { + if (!isStudentAudioPlaying) { + temp_Student_audio.pause(); + props.setVoiceAnimate(false); + } else { + temp_Student_audio.play(); + props.setVoiceAnimate(true); + } + temp_Student_audio.onended = function () { + setPauseAudio(false); + props.setVoiceAnimate(false); + }; + temp_Student_audio.addEventListener("ended", () => + setIsStudentAudioPlaying(false) + ); + } + return () => { + if (temp_Student_audio !== null) { + temp_Student_audio.pause(); + } + }; + }, [temp_Student_audio]); + useEffect(() => { if (temp_audio !== null) { if (!pauseAudio) { @@ -331,6 +366,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); @@ -466,6 +504,17 @@ function VoiceAnalyser(props) { ); setApiResponse(callUpdateLearner ? data.status : "success"); + + if ( + callUpdateLearner && + (props.pageName === "wordsorimage" || props.pageName === "m5") + ) { + const isMatching = + data?.createScoreData?.session?.error_rate?.character === 0; + if (typeof props.updateStoredData === "function") { + props.updateStoredData(recordedAudio, isMatching); + } + } if (props.handleNext) { props.handleNext(); if (temp_audio !== null) { @@ -492,15 +541,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; } @@ -671,28 +721,24 @@ function VoiceAnalyser(props) { } })() )} - <Box sx={{ display: "flex", justifyContent: "center", mt: 4 }}> - {props.enableNext && ( - <Box - sx={{ cursor: "pointer" }} - onClick={() => { - if ( - props.pageName === "wordsorimage" || - props.pageName === "m5" - ) { - props.updateStoredData(recordedAudio, isMatching); - } - if (props.setIsNextButtonCalled) { - props.setIsNextButtonCalled(true); - } else { - props.handleNext(); - } - }} - > - <NextButtonRound /> - </Box> - )} - </Box> + {!loader && ( + <Box sx={{ display: "flex", justifyContent: "center", mt: 4 }}> + {props.enableNext && ( + <Box + sx={{ cursor: "pointer" }} + onClick={() => { + if (props.setIsNextButtonCalled) { + props.setIsNextButtonCalled(true); + } else { + props.handleNext(); + } + }} + > + <NextButtonRound /> + </Box> + )} + </Box> + )} </div> ); } @@ -702,7 +748,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, diff --git a/src/utils/constants.js b/src/utils/constants.js index b2de957..5802c37 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3329,365 +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", - 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" }, - { title: "P5", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { title: "P6", criteria: "word", template: "simple", tags: "CEFR_ENG" }, - { - 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" }, - ], - 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: "word", template: "simple", competency: "L1.1" }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.2", - }, - { - title: "P3", - criteria: "sentence", - template: "simple", - competency: "L1.1", - }, - { - title: "P4", - criteria: "sentence", - template: "simple", - competency: "L1.2", - }, - { - title: "S1", - criteria: "sentence", - template: "simple", - 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", - }, - { - title: "P6", - criteria: "sentence", - template: "simple", - mechanism: { id: "", name: "FormASentence" }, - competency: "L1.1", - }, - { - title: "P7", - criteria: "sentence", - template: "simple", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - competency: "L1.2", - }, - { - title: "P8", - criteria: "sentence", - template: "simple", - competency: "L1.1", - }, - { - title: "S2", - criteria: "sentence", - template: "simple", - mechanism: { id: "mechanic_2", name: "readTheImage" }, - competency: "L1.2", - }, - ], - 5: [ - { - title: "P1", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "P2", - criteria: "sentence", - template: "simple", - competency: "L1.6", - }, - { - title: "P3", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "P4", - criteria: "sentence", - template: "simple", - competency: "L1.6", - }, - { title: "S1", criteria: "sentence", template: "simple" }, - { - title: "P5", - criteria: "sentence", - template: "simple", - competency: "L1.6", - }, - { - title: "P6", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "P7", - criteria: "sentence", - template: "simple", - competency: "L1.6", - }, - { - title: "P8", - criteria: "sentence", - template: "simple", - competency: "L1.5", - }, - { - title: "S2", - criteria: "sentence", - template: "simple", - competency: "L1.6", - }, - ], - 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: "mechanic_3", 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: "mechanic_3", 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: "mechanic_3", 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: "mechanic_3", 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 bcf017b..55e8e57 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 = []; @@ -717,8 +746,10 @@ const Practice = () => { 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[0]?.mechanics_id === + "mechanic_2" || + questions[currentQuestion]?.mechanics_data[0]?.mechanics_id === + "mechanic_1") ? 500 : stringLengths[0]; window.parent.postMessage({ type: "stringLengths", length }, "*"); @@ -953,7 +984,7 @@ const Practice = () => { }} /> ); - } else if (mechanism.name === "FormASentence") { + } else if (mechanism.name === "formASentence") { return ( <Mechanics4 page={page}