// import React from 'react'; // import { Link, useParams, useLocation } from 'react-router-dom'; // import { Container, Row, Col, Button } from 'react-bootstrap'; // import staydown from '../../assets/images/user/resultStay.png' // import jump from '../../assets/images/user/resultJump.png' // import finish from '../../assets/images/user/resultFinish.png' // const ExerciseResult = () => { // const { section, topic } = useParams(); // const location = useLocation(); // localStorage.removeItem('answers'); // return ( // // // {/* nilai sudah diatas KKM */} // //

Your Result!

// / //

// You scored 60/100. Great job! You can jump to... //

//

LEVEL 3

// // // {/* jika nilai dibawah KKM */} // //

Your Result!

// / //

// You scored 30/100. Good effort! To improve, you can focus on... //

//

LEVEL 3

// // // {/* jika nilai sudah bagus tetapi belum cukup untuk ke level selanjutnya */} // //

Your Result!

// / //

// You scored 30/100. Learning is a journey.
// Let's explore this level further to deepen your knowledge. //

//

LEVEL 2

// // // {/* jika yang telah dikerjakan adalah level 5 */} // //

Your Result!

// / //

// Way to go! You conquered LEVEL 5 with a 90/100! You're a rock star! //

//

LEVEL 2

// // //
//
// ); // }; // export default ExerciseResult; import React from 'react'; import { Link, useParams, useLocation } from 'react-router-dom'; import { Container, Row, Col, Button } from 'react-bootstrap'; import staydown from '../../../../assets/images/illustration/resultStay.png'; import jump from '../../../../assets/images/illustration/resultJump.png'; import finish from '../../../../assets/images/illustration/resultFinish.png'; import useResults from '../hooks/useResults'; const ExerciseResult = () => { const { section, topic, level } = useParams(); const location = useLocation(); const { answers } = location.state || { answers: [] }; const { score, nextLevel } = useResults(answers); let resultImage; let resultText; let resultColor; if (nextLevel === 0) { resultImage = finish; resultColor = 'text-blue'; resultText = ( <> Way to go! You conquered LEVEL 5 with a {score}/100! You're a rock star! ); } else if (score >= 60) { resultImage = jump; resultColor = 'text-blue'; resultText = ( <> You scored {score}/100. Great job! You can jump to... ); } else if (score >= 40) { resultImage = staydown; resultColor = ''; resultText = ( <> You scored {score}/100. Learning is a journey.
Let's explore this level further to deepen your knowledge. ); } else { resultImage = staydown; resultColor = 'text-red'; resultText = ( <> You scored {score}/100. Good effort! To improve, you can focus on... ); } return (

Your Result!

/

{resultText}

{nextLevel === 0 ? '' : `LEVEL ${nextLevel}`}

); }; export default ExerciseResult;