diff --git a/public/saveGameAI.js b/public/saveGameAI.js index df74032..8f65b64 100644 --- a/public/saveGameAI.js +++ b/public/saveGameAI.js @@ -312,26 +312,24 @@ function submitUserData(drawingZone) { setTimeout(() => { if (data && data.message === "Game data saved successfully") { starValue = data.data.score; + let feedbackMessage = ''; + if (starValue >= 1 && starValue <= 3) { + feedbackMessage = "You're making progress! Let's keep going!"; + } else if (starValue >= 4 && starValue <= 6) { + feedbackMessage = "Nice work! You're improving every day!"; + } else if (starValue >= 7 && starValue <= 8) { + feedbackMessage = "Amazing work! Keep it up!"; + } else if (starValue >= 9 && starValue <= 10) { + feedbackMessage = "Outstanding! You're a true superstar!"; + } else { + feedbackMessage = "Invalid star value."; + } loadingMainContainer.style.display = 'none'; loadingDiv.style.display = 'none'; starContainer.style.display = 'flex'; starContainer.style.flexDirection = 'row'; - document.getElementById('countStar').innerHTML = starValue; - for (let i = 0; i < starValue; i++) { - const starDiv = document.createElement('div'); - starDiv.innerHTML = starSVG; - starDiv.classList.add('star'); - starContainer.appendChild(starDiv); - setTimeout(() => { - starDiv.style.opacity = '1'; - starDiv.style.animationDelay = `${i * 0.5}s`; - }, i * 500); - } - for (let i = 0; i < maxStarValue - starValue; i++) { - const starDiv = document.createElement('div'); - starDiv.innerHTML = blankStar; - starContainer.appendChild(starDiv); - } + document.getElementById('get-star-value').innerHTML = starValue; + document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage; scoreBoard.style.display = 'flex'; if (scoreBoard.style.display === 'flex') { const bottomAnimateClipart = document.getElementById('bottomAnimateClipart'); diff --git a/src/pages/drawing/drawing_phonics.astro b/src/pages/drawing/drawing_phonics.astro index 1aa6329..c11dd0b 100644 --- a/src/pages/drawing/drawing_phonics.astro +++ b/src/pages/drawing/drawing_phonics.astro @@ -18,11 +18,14 @@ import Layout from '../../layouts/Layout.astro';