This commit is contained in:
Suvodip
2024-10-02 21:19:54 +05:30
parent b8994802cb
commit 2e342cd642
19 changed files with 1061 additions and 78 deletions

View File

@@ -104,7 +104,7 @@ import Layout from "../../layouts/Layout.astro";
</div>
</div>
<div class="flex flex-col justify-center place-items-center pt-8">
<p class="text-[20px] font-[600] text-[#FF0000] px-[20px] py-[10px]" style="display: none;" id="errorMessage">Please select at least 3 options.</p>
<p class="text-[20px] font-[600] text-[#FF0000] px-[20px] py-[10px]" style="display: none;" id="errorMessage">Please select at least 1 options.</p>
<p class="text-[20px] font-[600] text-[#FFFFFF] bg-[#004aad] px-[20px] py-[10px]" style="display: none;" id="savedMessage"></p>
</div>
</form>
@@ -123,7 +123,7 @@ import Layout from "../../layouts/Layout.astro";
</div>
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
<img class="z-10" src="/assets/clip-art.svg" alt="" />
<p class="text-[#0348A8] text-[12px] font-[700] p-6 rounded-[10px] -ml-[10px]" style="background: linear-gradient(270.05deg, #FFFFFF 4.67%, #DAEAFF 99.61%);">Well done! <span id="countStar"></span> stars for your effort! <br> Keep pushing, youve got this!</p>
<p id="starFeedbackMessage" class="text-[#0348A8] text-[12px] font-[700] p-6 rounded-[10px] -ml-[10px]" style="background: linear-gradient(270.05deg, #FFFFFF 4.67%, #DAEAFF 99.61%);"></p>
</div>
<div class="flex flex-col w-full max-w-sm items-center justify-center mx-auto gap-3">
<button class="rounded-[4px] bg-[#0348A8] text-[#FFF] text-[12px] font-[700] p-2.5 w-full border-[1px] border-[#0348A8]">Wow, Lets Go</button>
@@ -252,11 +252,11 @@ import Layout from "../../layouts/Layout.astro";
document.getElementById('allParentDiv').style.display = 'block';
const checkboxes = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9'];
const checkedCount = checkboxes.filter(id => document.getElementById(id).checked).length;
if (checkedCount < 3) {
if (checkedCount < 0) {
// Show error message if less than 3 checkboxes are checked
let errorMessageSection = document.getElementById('errorMessage');
errorMessageSection.style.display = "block";
errorMessageSection.innerHTML = 'Please select at least 2 options.';
errorMessageSection.innerHTML = 'Please select at least 1 options.';
return;
} else {
// Hide error message if validation passes
@@ -284,6 +284,7 @@ import Layout from "../../layouts/Layout.astro";
}
});
wrongCount === 0 ? starValue = 5 : wrongCount === 1 ? starValue = 4 : starValue = 3;
let feedbackMessage; starValue === 5 ? feedbackMessage = `Fantastic! You earned ${starValue} stars! <br> Keep up the amazing work you're a superstar!` : starValue === 4 ? feedbackMessage = `Great job! ${starValue} stars you're so close to <br> perfection! ` : starValue === 3 ? feedbackMessage = `Well done! ${starValue} stars for your effort! <br> Keep pushing, youve got this!` : '';
let userData = {
'gameName': gameName,
@@ -366,7 +367,7 @@ import Layout from "../../layouts/Layout.astro";
loadingDiv.style.display = 'none';
starContainer.style.display = 'flex';
starContainer.style.flexDirection = 'row';
document.getElementById('countStar').innerHTML = starValue;
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
for (let i = 0; i < starValue; i++) {
const starDiv = document.createElement('div');
starDiv.innerHTML = starSVG;