Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Layouts.jsx/MainLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ const MainLayout = (props) => {
}}
>
{!gameOverData ? "Start Game ➜" : "Practice ➜"}
</span>
</Typography>
{/* <NextButton /> */}
</Box>
</Box>
Expand Down
37 changes: 3 additions & 34 deletions src/views/Practice/Practice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ const Practice = () => {

};

const isFirefox = () => {
return typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().includes('firefox');
};

useEffect(() => {
if (startShowCase) {
setLivesData({ ...livesData, lives: LIVES });
Expand All @@ -88,19 +84,14 @@ const Practice = () => {
Number(currentPracticeStep + 1) > 0 &&
currentQuestion === 0 &&
!fromBack
// !state?.refresh
) {
setDisableScreen(true);
callConfettiAndPlay();

setTimeout(() => {
// alert(
// `You have successfully completed ${practiceSteps[currentPracticeStep].fullName} `
// );
setOpenMessageDialog({
message: `You have successfully completed ${practiceSteps[currentPracticeStep].fullName} `,
});
// setDisableScreen(false);
}, 1200);
}
}, [currentQuestion]);
Expand All @@ -117,13 +108,10 @@ const Practice = () => {
message: "Sorry I couldn't hear a voice. Could you please speak again?",
isError: true,
});
// alert("Sorry I couldn't hear a voice. Could you please speak again?");
setVoiceText("");
setEnableNext(false);
}
if (voiceText == "success") {
// setEnableNext(true);
// go_to_result(voiceText);
setVoiceText("");
}
//eslint-disable-next-line
Expand Down Expand Up @@ -217,7 +205,6 @@ const Practice = () => {
currentQuestion === questions.length - 1 || isGameOver
? currentPracticeStep + 1
: currentPracticeStep;
newPracticeStep = Number(newPracticeStep);
let newQuestionIndex =
currentQuestion === questions.length - 1 ? 0 : currentQuestion + 1;

Expand Down Expand Up @@ -287,7 +274,7 @@ const Practice = () => {

let quesArr = [];

if (newPracticeStep === 10) {
if (newPracticeStep == 10) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use strict equality checks.

Loose equality checks (==) can lead to unexpected type coercion. It's generally recommended to use strict equality checks (===) to avoid such issues.

- if (newPracticeStep == 10) {
+ if (newPracticeStep === 10) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (newPracticeStep == 10) {
if (newPracticeStep === 10) {

newPracticeStep = 0;
currentPracticeProgress = 0;
}
Expand All @@ -309,7 +296,7 @@ const Practice = () => {
}
);

if (newPracticeStep === 0 || newPracticeStep === 5 || isGameOver) {
if (newPracticeStep == 0 || newPracticeStep == 5 || isGameOver) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use strict equality checks.

Loose equality checks (==) can lead to unexpected type coercion. It's generally recommended to use strict equality checks (===) to avoid such issues.

- if (newPracticeStep == 0 || newPracticeStep == 5 || isGameOver) {
+ if (newPracticeStep === 0 || newPracticeStep === 5 || isGameOver) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (newPracticeStep == 0 || newPracticeStep == 5 || isGameOver) {
if (newPracticeStep === 0 || newPracticeStep === 5 || isGameOver) {

gameOver();
return;
// navigate("/assesment-end");
Expand Down Expand Up @@ -376,11 +363,6 @@ const Practice = () => {
}
};

// const playAudio = () => {
// // const myAudio = localStorage.getItem("recordedAudio");
// set_temp_audio(new Audio(recordedAudio));
// };

useEffect(() => {
learnAudio();
}, [temp_audio]);
Expand Down Expand Up @@ -506,12 +488,6 @@ const Practice = () => {
fetchDetails();
}, []);

// useEffect(() => {
// if (state?.refresh) {
// setGameOverData(undefined);
// fetchDetails();
// }
// }, [state]);

const handleBack = async () => {
if (progressData.currentPracticeStep > 0) {
Expand Down Expand Up @@ -574,11 +550,7 @@ const Practice = () => {
setCurrentQuestion(practiceProgress[virtualId]?.currentQuestion || 0);
setLocalData("practiceProgress", JSON.stringify(practiceProgress));
} else {
if (process.env.REACT_APP_IS_APP_IFRAME === 'true') {
navigate("/");
}else {
navigate("/discover-start")
}
navigate(process.env.REACT_APP_IS_APP_IFRAME === 'true' ? '/' : '/discover-start');
}
};

Expand Down Expand Up @@ -735,7 +707,6 @@ const Practice = () => {
storyLine,
handleNext,
type: questions[currentQuestion]?.contentType,
// image: elephant,
enableNext,
showTimer: false,
points,
Expand Down Expand Up @@ -789,7 +760,6 @@ const Practice = () => {
setVoiceAnimate,
storyLine,
handleNext,
// image: elephant,
enableNext,
showTimer: false,
points,
Expand Down Expand Up @@ -835,7 +805,6 @@ const Practice = () => {
storyLine,
handleNext,
type: "word",
// image: elephant,
enableNext,
showTimer: false,
points,
Expand Down