After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 3.1 MiB |
After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 2.2 MiB |
|
@ -0,0 +1,20 @@
|
|||
<svg width="121" height="121" viewBox="0 0 121 121" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M20.4126 115.787C19.8985 114.112 21.2639 107.552 21.2639 107.552L27.369 113.403L60.1015 95.9766L92.8969 114.903L99.6269 108.807C99.6269 108.807 100.189 114.133 99.6269 115.787C98.858 118.049 97.4089 118.881 95.4323 119.59C93.7998 120.176 90.0446 119.946 90.0446 119.946L60.1015 102.704C60.1015 102.704 41.6796 112.319 29.8756 119.946C29.8756 119.946 25.9562 120.657 24.1855 119.946C22.2765 119.18 21.0992 118.024 20.4126 115.787Z" fill="url(#paint0_linear_6328_4264)"/>
|
||||
<path d="M119.781 43.9461C119.397 42.7568 118.672 41.7068 117.695 40.9269C116.719 40.147 115.534 39.6717 114.29 39.5603L79.6497 36.4147L65.9524 4.35427C64.9421 2.00477 62.642 0.484375 60.0865 0.484375C57.5309 0.484375 55.2306 2.005 54.2208 4.36013L40.5232 36.415L5.87788 39.5603C4.6346 39.6742 3.45208 40.1505 2.47694 40.9301C1.5018 41.7097 0.776923 42.7584 0.392182 43.9461C-0.398019 46.3765 0.331704 49.042 2.25739 50.7223L28.4412 73.6852L20.7201 107.696C20.1552 110.197 21.1256 112.782 23.2007 114.282C24.3157 115.087 25.6207 115.498 26.9365 115.498C28.071 115.498 29.1962 115.192 30.2065 114.587L60.0865 96.729L89.9556 114.587C92.1413 115.902 94.8966 115.782 96.9669 114.282C97.9804 113.548 98.756 112.532 99.197 111.362C99.638 110.191 99.7251 108.916 99.4474 107.696L91.7266 73.6852L117.91 50.727C118.852 49.9043 119.531 48.8231 119.864 47.6175C120.197 46.412 120.168 45.1353 119.781 43.9461Z" fill="#FFD211"/>
|
||||
<path d="M0.207031 52.9141V46.6641L28.9254 73.6811L27.955 78.1922L0.207031 52.9141Z" fill="url(#paint1_linear_6328_4264)"/>
|
||||
<path d="M120.094 52.9141V46.6641L91.3754 73.6811L92.3458 78.1922L120.094 52.9141Z" fill="url(#paint2_linear_6328_4264)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_6328_4264" x1="60.0299" y1="95.9766" x2="60.0299" y2="120.19" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_6328_4264" x1="14.5662" y1="46.6641" x2="14.5662" y2="78.1922" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_6328_4264" x1="105.735" y1="46.6641" x2="105.735" y2="78.1922" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
|
@ -1,11 +0,0 @@
|
|||
|
||||
<svg width="169" height="133" viewBox="0 0 169 133" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M164.295 56.3359L133.293 75.7852L134.58 102.781L167.852 68.1232L164.295 56.3359Z" fill="#FF3141" stroke="black" stroke-width="0.745489"/>
|
||||
<path d="M3.59817 61.5937C3.23014 65.0223 2.23257 66.8818 0.605469 67.1724C1.67083 67.9762 1.88875 69.6324 1.25921 72.1408C0.774958 74.9592 1.61272 76.4555 3.7725 76.6299C5.64173 63.2063 9.68042 51.4292 15.8886 41.2986C12.8184 45.2598 9.60779 47.1581 6.25674 46.9934C6.33422 49.5406 6.95406 51.2888 8.11628 52.2379C5.63689 53.6907 3.66597 54.2718 2.20351 53.9812C2.15509 57.5357 2.61997 60.0732 3.59817 61.5937ZM51.0891 4.73241C50.4402 5.36195 49.8107 6.01569 49.2005 6.69365C45.3071 10.9551 42.2466 15.8509 40.0191 21.3811C46.3531 10.4079 54.0528 5.64766 63.1181 7.10043C63.6798 6.27719 63.3553 5.26994 62.1447 4.07867C58.3966 0.814784 54.7114 1.0327 51.0891 4.73241ZM121.069 32.5384C122.008 33.7297 122.817 34.7999 123.495 35.749C128.134 42.1993 131.882 52.7997 134.74 67.5501C134.807 67.9569 134.88 68.354 134.957 68.7414C136.381 68.2184 137.519 67.2983 138.371 65.9811C136.405 64.7705 134.793 62.3153 133.534 58.6156C134.938 58.1216 135.921 57.4873 136.483 56.7124C135.098 56.2766 133.834 54.543 132.691 51.5115C133.611 51.6084 134.531 50.9256 135.451 49.4631C132.275 47.3227 129.229 43.2404 126.313 37.2163C124.832 34.1752 123.083 32.6159 121.069 32.5384ZM94.0765 8.93091C93.6601 8.38855 93.2581 7.88492 92.8707 7.42003C91.0015 5.14403 89.4761 3.61378 88.2945 2.82929C84.4398 0.0399762 81.1178 0.0399762 78.3285 2.82929C77.8249 3.97213 78.3092 5.05202 79.7813 6.06896C80.1493 6.32078 80.8418 6.23845 81.8588 5.82199C84.4641 4.776 86.7885 5.00844 88.832 6.51932C90.1492 7.46846 91.4034 8.66942 92.5947 10.1222C94.5317 12.4369 97.5632 13.6669 101.689 13.8122C98.6092 13.1343 96.0717 11.5072 94.0765 8.93091Z" fill="#130704"/>
|
||||
<path d="M111.975 21.4681C109.059 18.0589 105.926 15.628 102.575 14.1752C102.478 14.1268 102.382 14.0881 102.285 14.059L102.139 14.0154C101.975 13.9476 101.825 13.8798 101.689 13.812C97.5632 13.6667 94.5318 12.4367 92.5947 10.122C91.4035 8.66923 90.1492 7.46827 88.8321 6.51913C86.7885 5.00825 84.4641 4.77581 81.8588 5.8218C80.8419 6.23826 80.1494 6.32059 79.7813 6.06877C78.3092 5.05184 77.8249 3.97195 78.3286 2.8291C75.8298 3.77824 70.4352 4.1947 62.1447 4.07848C63.3554 5.26975 63.6798 6.277 63.1181 7.10024C54.0528 5.64747 46.3531 10.4077 40.0191 21.3809C42.2467 15.8507 45.3072 10.9549 49.2006 6.69346C46.4016 8.27214 44.0723 10.1559 42.2128 12.3447C40.3532 14.5336 37.3121 17.042 33.0894 19.8701C28.8376 22.7078 23.7917 28.8627 17.9515 38.3347C17.2736 39.4292 16.5859 40.417 15.8886 41.2984C9.68045 51.429 5.64176 63.2061 3.77253 76.6297C3.72411 76.9106 3.68536 77.1914 3.65631 77.4723C2.17449 99.0701 2.85729 116.13 5.70471 128.653C6.38267 131.2 7.09937 132.464 7.85481 132.445L129.945 130.368C130.943 130.387 131.635 129.767 132.023 128.508C137.427 108.886 138.405 88.9637 134.957 68.7412C134.88 68.3538 134.807 67.9567 134.74 67.5499C131.882 52.7995 128.134 42.1991 123.495 35.7488C122.817 34.7997 122.008 33.7295 121.069 32.5382C118.783 29.6036 115.752 25.9136 111.975 21.4681ZM45.2926 25.6957C49.157 21.6279 53.2925 19.9475 57.6993 20.6546C62.1157 21.3809 65.5055 24.2865 67.8686 29.3712C70.2705 34.4946 70.9388 40.3153 69.8735 46.8334C68.8081 53.3321 66.3384 58.6299 62.4643 62.7267C58.6097 66.8332 54.479 68.5233 50.0722 67.7969C45.6558 67.0899 42.2563 64.1746 39.8738 59.0512C37.4913 53.9471 36.8327 48.1409 37.898 41.6325C38.9634 35.1144 41.4283 29.8022 45.2926 25.6957ZM74.1737 30.1121C76.2172 25.7538 79.0646 23.3567 82.7159 22.9209C86.3769 22.5141 89.7861 24.2042 92.9434 27.991C96.1298 31.7779 98.1153 36.5769 98.8998 42.388C99.7036 48.1506 99.0838 53.2305 97.0402 57.6275C95.0451 62.0245 92.2122 64.4216 88.5415 64.8187C84.8709 65.2545 81.452 63.5645 78.285 59.7485C75.1373 55.981 73.1616 51.2014 72.3577 45.4097C71.5538 39.6083 72.1591 34.5091 74.1737 30.1121ZM47.4863 84.2131L57.4378 82.7458L71.3698 79.4771C75.0114 78.7411 78.4351 78.2132 81.6409 77.8936C90.832 76.9929 98.2024 77.8694 103.752 80.5231C104.769 81.0074 105.728 81.5546 106.628 82.1647C110.967 85.7095 111.418 92.2227 107.98 101.704C107.273 104.068 106.076 106.208 104.391 108.126C100.168 112.91 92.8901 116.237 82.5561 118.106C79.515 118.649 76.1978 119.075 72.6047 119.385C62.9099 119.83 54.5468 118.639 47.5154 115.811C43.9997 114.397 40.8278 112.576 37.9997 110.348C31.8787 105.564 28.4405 100.736 27.6851 95.8643C27.0071 89.4237 30.2904 86.0243 37.5349 85.6659L47.4863 84.2131Z" fill="#FF3141"/>
|
||||
<path d="M37.5354 85.6655C30.291 86.0238 27.0077 89.4233 27.6857 95.8639C28.4411 100.736 31.8793 105.564 38.0003 110.348C40.8284 112.576 44.0002 114.396 47.5159 115.81L47.4869 84.2127L37.5354 85.6655ZM103.753 80.5227C98.203 77.8689 90.8326 76.9924 81.6414 77.8932L82.5567 118.106C92.8907 116.237 100.169 112.91 104.392 108.125L103.753 80.5227ZM106.629 82.1643C105.728 81.5541 104.77 81.0069 103.753 80.5227L104.392 108.125C106.077 106.208 107.273 104.067 107.98 101.704C111.418 92.2223 110.968 85.709 106.629 82.1643ZM57.4383 82.7454L47.4869 84.2127L47.5159 115.81C54.5473 118.638 62.9104 119.83 72.6052 119.384C76.1984 119.074 79.5156 118.648 82.5567 118.106L81.6414 77.8932C78.4357 78.2128 75.012 78.7406 71.3704 79.4767L57.4383 82.7454Z" fill="#FDFBFD"/>
|
||||
<path d="M82.716 22.9214C79.0647 23.3572 76.2172 25.7543 74.1737 30.1126C72.1592 34.5096 71.5539 39.6089 72.3577 45.4102C73.1616 51.2019 75.1374 55.9815 78.285 59.7491C81.452 63.565 84.8709 65.255 88.5415 64.8192C92.2122 64.4221 95.0451 62.0251 97.0402 57.628C99.0838 53.231 99.7037 48.1511 98.8998 42.3885C98.1153 36.5774 96.1298 31.7784 92.9434 27.9916C89.7861 24.2047 86.3769 22.5146 82.716 22.9214ZM79.7523 41.4006C79.6264 40.19 79.6651 39.144 79.8685 38.2626C80.101 37.4103 80.4496 36.9503 80.9145 36.8825C81.3794 36.8341 81.8201 37.2021 82.2365 37.9866C82.6433 38.7808 82.9193 39.7783 83.0646 40.9793C83.2196 42.1899 83.1857 43.2214 82.9629 44.0737C82.7402 44.9938 82.3963 45.4684 81.9315 45.4974C81.4569 45.5652 81.0114 45.1875 80.5949 44.3643C80.1978 43.5798 79.917 42.5919 79.7523 41.4006ZM57.6993 20.6551C53.2926 19.9481 49.157 21.6284 45.2927 25.6962C41.4283 29.8027 38.9634 35.115 37.8981 41.633C36.8327 48.1414 37.4913 53.9477 39.8738 59.0517C42.2564 64.1752 45.6559 67.0904 50.0723 67.7974C54.479 68.5238 58.6097 66.8337 62.4644 62.7272C66.3384 58.6304 68.8081 53.3327 69.8735 46.834C70.9388 40.3159 70.2706 34.4951 67.8687 29.3717C65.5055 24.287 62.1157 21.3815 57.6993 20.6551ZM55.2151 41.3425C55.4281 39.8122 55.8398 38.558 56.4499 37.5798C57.0891 36.5629 57.7477 36.1028 58.4257 36.1997C59.123 36.2965 59.6315 36.9164 59.9511 38.0592C60.3191 39.1924 60.3966 40.5241 60.1835 42.0543C59.9898 43.5652 59.5492 44.8195 58.8615 45.817C58.2513 46.7952 57.5976 47.2456 56.9003 47.1681C56.2223 47.0712 55.709 46.4611 55.3603 45.3376C55.0698 44.1948 55.0214 42.8631 55.2151 41.3425Z" fill="#FBF2FD"/>
|
||||
<path d="M79.8683 38.2621C79.6649 39.1434 79.6262 40.1894 79.7521 41.4001C79.9167 42.5913 80.1976 43.5792 80.5947 44.3637C81.0112 45.1869 81.4567 45.5647 81.9312 45.4969C82.3961 45.4678 82.74 44.9932 82.9627 44.0732C83.1855 43.2209 83.2194 42.1894 83.0644 40.9788C82.9191 39.7778 82.6431 38.7802 82.2363 37.9861C81.8199 37.2016 81.3792 36.8335 80.9143 36.882C80.4494 36.9498 80.1008 37.4098 79.8683 38.2621ZM56.4497 37.5793C55.8395 38.5575 55.4279 39.8117 55.2149 41.342C55.0212 42.8625 55.0696 44.1942 55.3601 45.3371C55.7088 46.4605 56.2221 47.0707 56.9001 47.1676C57.5974 47.245 58.2511 46.7947 58.8613 45.8165C59.5489 44.8189 59.9896 43.5647 60.1833 42.0538C60.3964 40.5236 60.3189 39.1919 59.9509 38.0587C59.6313 36.9159 59.1228 36.296 58.4255 36.1992C57.7475 36.1023 57.0889 36.5623 56.4497 37.5793Z" fill="#051917"/>
|
||||
<path d="M92.8711 7.41992C93.2585 7.88481 93.6604 8.38843 94.0769 8.9308C96.072 11.507 98.6095 13.1341 101.689 13.8121C101.825 13.8799 101.975 13.9477 102.14 14.0155C99.2633 12.5821 96.1737 10.3836 92.8711 7.41992Z" fill="#DE0103"/>
|
||||
<path d="M101.689 13.8122C98.6092 13.1343 96.0717 11.5072 94.0765 8.93091C93.6601 8.38855 93.2581 7.88492 92.8707 7.42003C91.0015 5.14403 89.4761 3.61378 88.2945 2.82929C84.4398 0.0399763 81.1178 0.0399763 78.3285 2.82929C77.8249 3.97213 78.3092 5.05202 79.7813 6.06896C80.1493 6.32077 80.8418 6.23845 81.8588 5.82199C84.4641 4.776 86.7885 5.00844 88.832 6.51932C90.1492 7.46846 91.4034 8.66941 92.5947 10.1222C94.5317 12.4369 97.5632 13.6669 101.689 13.8122ZM101.689 13.8122C101.825 13.88 101.975 13.9478 102.139 14.0156C99.2629 12.5822 96.1734 10.3837 92.8707 7.42003M121.069 32.5384C118.783 29.6038 115.752 25.9138 111.975 21.4683C109.059 18.0591 105.926 15.6282 102.575 14.1754C102.478 14.127 102.382 14.0882 102.285 14.0592L102.139 14.0156M134.957 68.7413C134.88 68.3539 134.807 67.9569 134.739 67.5501C131.882 52.7996 128.134 42.1993 123.495 35.749C122.817 34.7999 122.008 33.7296 121.069 32.5384C123.083 32.6159 124.832 34.1752 126.313 37.2163C129.229 43.2404 132.275 47.3227 135.451 49.4631C134.531 50.9256 133.611 51.6084 132.691 51.5115C133.834 54.543 135.098 56.2766 136.483 56.7124C135.921 57.4872 134.938 58.1216 133.534 58.6156C134.793 62.3153 136.405 64.7705 138.371 65.9811C137.519 67.2983 136.381 68.2184 134.957 68.7413ZM134.957 68.7413C138.405 88.9639 137.427 108.886 132.023 128.508C131.635 129.767 130.943 130.387 129.945 130.368L7.85478 132.445C7.09934 132.465 6.38264 131.201 5.70468 128.653C2.85726 116.131 2.17446 99.0703 3.65628 77.4725C3.68534 77.1916 3.72408 76.9107 3.7725 76.6299C1.61272 76.4555 0.774958 74.9592 1.25921 72.1408C1.88875 69.6324 1.67083 67.9762 0.605469 67.1724C2.23257 66.8818 3.23014 65.0223 3.59817 61.5937C2.61997 60.0732 2.15509 57.5357 2.20351 53.9812C3.66597 54.2718 5.63689 53.6907 8.11628 52.2379C6.95406 51.2888 6.33422 49.5406 6.25674 46.9934C9.60779 47.1581 12.8184 45.2598 15.8886 41.2986C16.5859 40.4172 17.2736 39.4293 17.9515 38.3349C23.7916 28.8629 28.8376 22.708 33.0894 19.8703C37.3121 17.0422 40.3532 14.5338 42.2127 12.3449C44.0723 10.1561 46.4015 8.27232 49.2005 6.69365C49.8107 6.01569 50.4402 5.36195 51.0891 4.73241C54.7114 1.0327 58.3966 0.814784 62.1447 4.07867C70.4352 4.19489 75.8298 3.77843 78.3285 2.82929M62.1447 4.07867C63.3553 5.26994 63.6798 6.27719 63.1181 7.10043C54.0528 5.64766 46.3531 10.4079 40.0191 21.3811C39.9222 21.5555 39.8205 21.7395 39.714 21.9332M47.4863 84.2133L57.4377 82.746L71.3698 79.4773C75.0114 78.7412 78.4351 78.2134 81.6408 77.8938C90.832 76.9931 98.2024 77.8696 103.752 80.5233C104.769 81.0075 105.728 81.5548 106.628 82.1649C110.967 85.7097 111.418 92.2229 107.98 101.705C107.273 104.068 106.076 106.208 104.391 108.126C100.168 112.91 92.8901 116.237 82.5561 118.106C79.515 118.649 76.1978 119.075 72.6046 119.385C62.9098 119.83 54.5467 118.639 47.5153 115.811C43.9996 114.397 40.8278 112.576 37.9997 110.349C31.8787 105.564 28.4405 100.736 27.6851 95.8645C27.0071 89.4239 30.2904 86.0244 37.5348 85.6661L47.4863 84.2133ZM47.4863 84.2133L47.5153 115.811M15.8886 41.2986C9.68043 51.4292 5.64173 63.2063 3.7725 76.6299M81.6408 77.8938L82.5561 118.106M49.2005 6.69365C45.3071 10.9551 42.2466 15.8509 40.0191 21.3811M103.752 80.5233L104.391 108.126M60.1835 42.054C59.9898 43.5649 59.5491 44.8191 58.8614 45.8167C58.2513 46.7949 57.5975 47.2452 56.9002 47.1678C56.2223 47.0709 55.7089 46.4607 55.3603 45.3373C55.0697 44.1944 55.0213 42.8627 55.215 41.3422C55.4281 39.8119 55.8397 38.5577 56.4499 37.5795C57.0891 36.5625 57.7477 36.1025 58.4256 36.1994C59.1229 36.2962 59.6314 36.9161 59.951 38.0589C60.3191 39.1921 60.3965 40.5238 60.1835 42.054ZM69.8734 46.8336C68.8081 53.3323 66.3384 58.6301 62.4643 62.7269C58.6096 66.8334 54.4789 68.5234 50.0722 67.797C45.6558 67.09 42.2563 64.1748 39.8738 59.0514C37.4912 53.9473 36.8327 48.1411 37.898 41.6327C38.9634 35.1146 41.4282 29.8023 45.2926 25.6958C49.157 21.6281 53.2925 19.9477 57.6992 20.6547C62.1156 21.3811 65.5054 24.2867 67.8686 29.3713C70.2705 34.4948 70.9388 40.3155 69.8734 46.8336ZM83.0646 40.979C83.2195 42.1896 83.1856 43.2211 82.9629 44.0734C82.7401 44.9934 82.3963 45.468 81.9314 45.4971C81.4568 45.5649 81.0113 45.1871 80.5949 44.3639C80.1978 43.5794 79.9169 42.5915 79.7522 41.4003C79.6263 40.1896 79.6651 39.1436 79.8685 38.2623C80.1009 37.41 80.4496 36.95 80.9145 36.8822C81.3793 36.8337 81.82 37.2018 82.2365 37.9863C82.6433 38.7804 82.9193 39.778 83.0646 40.979ZM98.8997 42.3881C99.7036 48.1508 99.0837 53.2306 97.0402 57.6277C95.045 62.0247 92.2121 64.4218 88.5415 64.8189C84.8708 65.2547 81.452 63.5646 78.285 59.7487C75.1373 55.9812 73.1615 51.2016 72.3577 45.4099C71.5538 39.6085 72.1591 34.5093 74.1736 30.1123C76.2172 25.754 79.0646 23.3569 82.7159 22.9211C86.3769 22.5143 89.786 24.2043 92.9434 27.9912C96.1298 31.7781 98.1152 36.5771 98.8997 42.3881Z" stroke="black" stroke-width="0.87166" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 103 KiB |
|
@ -0,0 +1,32 @@
|
|||
<svg width="129" height="128" viewBox="0 0 129 128" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_d_8863_7800)">
|
||||
<path d="M24.3345 115.303C23.8203 113.627 25.1857 107.067 25.1857 107.067L31.2908 112.919L64.0234 95.4922L96.8188 114.418L103.549 108.323C103.549 108.323 104.111 113.649 103.549 115.303C102.78 117.565 101.331 118.396 99.3542 119.105C97.7216 119.691 93.9665 119.462 93.9665 119.462L64.0234 102.22C64.0234 102.22 45.6015 111.835 33.7975 119.462C33.7975 119.462 29.8781 120.172 28.1074 119.462C26.1984 118.695 25.021 117.539 24.3345 115.303Z" fill="url(#paint0_linear_8863_7800)"/>
|
||||
<path d="M123.703 43.4618C123.319 42.2725 122.594 41.2224 121.617 40.4425C120.641 39.6626 119.456 39.1873 118.212 39.0759L83.5716 35.9304L69.8743 3.8699C68.8639 1.52039 66.5639 0 64.0083 0C61.4528 0 59.1525 1.52063 58.1427 3.87576L44.4451 35.9306L9.79975 39.0759C8.55647 39.1898 7.37396 39.6661 6.39881 40.4457C5.42367 41.2253 4.6988 42.274 4.31406 43.4618C3.52386 45.8921 4.25358 48.5576 6.17927 50.2379L32.363 73.2008L24.642 107.212C24.0771 109.712 25.0475 112.297 27.1225 113.797C28.2376 114.603 29.5426 115.013 30.8583 115.013C31.9929 115.013 33.1181 114.707 34.1284 114.103L64.0083 96.2447L93.8775 114.103C96.0632 115.418 98.8184 115.298 100.889 113.797C101.902 113.064 102.678 112.048 103.119 110.877C103.56 109.706 103.647 108.432 103.369 107.212L95.6485 73.2008L121.832 50.2426C122.774 49.4199 123.453 48.3387 123.786 47.1332C124.118 45.9276 124.09 44.651 123.703 43.4618Z" fill="#FFD211"/>
|
||||
<path d="M4.12891 52.4297V46.1797L32.8473 73.1967L31.8769 77.7078L4.12891 52.4297Z" fill="url(#paint1_linear_8863_7800)"/>
|
||||
<path d="M124.016 52.4297V46.1797L95.2972 73.1967L96.2677 77.7078L124.016 52.4297Z" fill="url(#paint2_linear_8863_7800)"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d_8863_7800" x="0" y="0" width="128.016" height="127.781" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="4"/>
|
||||
<feGaussianBlur stdDeviation="2"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8863_7800"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_8863_7800" result="shape"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear_8863_7800" x1="63.9518" y1="95.4922" x2="63.9518" y2="119.706" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_8863_7800" x1="18.4881" y1="46.1797" x2="18.4881" y2="77.7078" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_8863_7800" x1="109.656" y1="46.1797" x2="109.656" y2="77.7078" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FD9F02"/>
|
||||
<stop offset="1" stop-color="#FDCF03"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
|
@ -6,9 +6,10 @@
|
|||
const userId = urlParams.get('userId');
|
||||
const gameVersion = urlParams.get('gameName');
|
||||
const gameId = urlParams.get('id');
|
||||
const spriteName = urlParams.get('spriteName');
|
||||
const assignmentId = urlParams.get('assignmentId');
|
||||
const worksheetId = urlParams.get('worksheetId');
|
||||
let submitNotic;
|
||||
|
||||
console.log(userId);
|
||||
let startTime = Date.now();
|
||||
|
||||
|
||||
|
@ -39,6 +40,7 @@
|
|||
// console.log(gameVersion)
|
||||
let imageCode;
|
||||
let gameScore;
|
||||
let timeDifferenceInSeconds;
|
||||
|
||||
// if(scoreTotal){
|
||||
// gameScore = scoreTotal;
|
||||
|
@ -49,6 +51,9 @@
|
|||
|
||||
function submitUserData(drawingZone) {
|
||||
submitButton.setVisible(false);
|
||||
galleryButton.setVisible(false);
|
||||
customCursor.setVisible(false);
|
||||
snapshotButton.setVisible(false);
|
||||
if(!gameType[0] === 'guided-tracing'){
|
||||
snapshotButton.setVisible(false);
|
||||
customCursor.setVisible(false);
|
||||
|
@ -59,13 +64,16 @@ function submitUserData(drawingZone) {
|
|||
|
||||
const endTime = Date.now();
|
||||
const timeDifference = endTime - startTime;
|
||||
const timeDifferenceInSeconds = timeDifference / 1000;
|
||||
timeDifferenceInSeconds = timeDifference / 1000;
|
||||
// console.log(`Time difference: ${timeDifferenceInSeconds} seconds`);
|
||||
|
||||
|
||||
// console.log('This is from main point', scoreTotal);
|
||||
drawingZone.renderer.snapshot((image) => {
|
||||
submitButton.setVisible(true);
|
||||
galleryButton.setVisible(true);
|
||||
customCursor.setVisible(true);
|
||||
snapshotButton.setVisible(true);
|
||||
if(!gameType[0] == "guided-tracing"){
|
||||
snapshotButton.setVisible(true);
|
||||
customCursor.setVisible(true);
|
||||
|
@ -117,38 +125,83 @@ function submitUserData(drawingZone) {
|
|||
'gameTime' : timeDifferenceInSeconds
|
||||
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
console.log('userData', userData)
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGalleryImage`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
console.log(response.status, " Data Saved Succesfully");
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('data from save gallery', data);
|
||||
|
||||
if(data.screenshotUrl){
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('saved-toast').classList.remove('hidden');
|
||||
setTimeout(() => {
|
||||
document.getElementById('saved-toast').classList.add('hidden');
|
||||
}, 2000);
|
||||
|
||||
// console.log(response.status, " Data Saved Succesfully");
|
||||
}
|
||||
} else {
|
||||
// console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: data.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
fetch(`https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : 'application/json',
|
||||
'Authorization' : authToken
|
||||
},
|
||||
body: JSON.stringify(userAnotherData)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('submissions api response', data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occured', error)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
|
||||
// Clear the drawing
|
||||
// graphics.clear();
|
||||
});
|
||||
console.error('An error occured', error);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function calculateFromAI(){
|
||||
let progress = 0;
|
||||
let starValue = 4;
|
||||
let maxStarValue = 5;
|
||||
function calculateFromAI(){
|
||||
let progress = 0;
|
||||
let starValue;
|
||||
let maxStarValue = 5;
|
||||
|
||||
function progressIncrement() {
|
||||
const interval = setInterval(() => {
|
||||
|
@ -234,10 +287,14 @@ function calculateFromAI(){
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
let userData = {
|
||||
'name' : 'Worksheet Name Here'
|
||||
gameName: gameVersion,
|
||||
userId: userId,
|
||||
gameID: gameId,
|
||||
gameTime: timeDifferenceInSeconds,
|
||||
screenShot: imageCode
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://game-du.teachertrainingkolkata.in/items/test`, {
|
||||
// console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/aiEvaluateImageToStar`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
@ -245,35 +302,51 @@ function calculateFromAI(){
|
|||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
if(!response.ok){
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
return response.json()
|
||||
})
|
||||
.then(data => {
|
||||
// console.log('data', data.data.score);
|
||||
setTimeout(() => {
|
||||
if (data && data.message === "Game data saved successfully") {
|
||||
starValue = data.data.score;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
if (scoreBoard.style.display === 'flex') {
|
||||
const bottomAnimateClipart = document.getElementById('bottomAnimateClipart');
|
||||
bottomAnimateClipart.classList.remove('hidden');
|
||||
bottomAnimateClipart.classList.add('-translate-x-full');
|
||||
bottomAnimateClipart.classList.add('transition-transform', 'duration-700');
|
||||
setTimeout(() => {
|
||||
bottomAnimateClipart.classList.add('hidden');
|
||||
bottomAnimateClipart.classList.remove('translate-x-full');
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
function retryGame(){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const userId = urlParams.get('userId');
|
||||
const gameVersion = urlParams.get('gameName');
|
||||
const gameId = urlParams.get('id');
|
||||
let submitNotic;
|
||||
|
||||
// console.log(userId);
|
||||
let startTime = Date.now();
|
||||
|
||||
|
||||
const url = window.location.href;
|
||||
const gameName = url.split('/');
|
||||
const gameType = gameName[3].split('?id=');
|
||||
// let gameVersion;
|
||||
|
||||
// console.log("Here is game name ", gameType[0])
|
||||
|
||||
// if(gameType[0] == "guided-tracing"){
|
||||
// gameVersion = gameType[0].split('?')[0];
|
||||
// gameId = gameName[4];
|
||||
// console.log('Type - 1');
|
||||
|
||||
// } else if(gameName.length == 4){
|
||||
// gameVersion = gameName[3].split('?')[0];
|
||||
// gameId = urlParams.get('id');
|
||||
// }
|
||||
// else if(gameName.length == 5){
|
||||
// gameVersion = gameName[3] + '-' + gameName[4].split('?')[0];
|
||||
// gameId = urlParams.get('id');
|
||||
// console.log('Type - 2');
|
||||
// }else if(gameName.length == 6){
|
||||
// gameVersion = gameType[0] + '-' + gameName[4];
|
||||
// gameId = urlParams.get('id');
|
||||
// console.log('Type - 3');
|
||||
// }
|
||||
|
||||
console.log(gameVersion)
|
||||
|
||||
function submitUserData(drawingZone) {
|
||||
const endTime = Date.now();
|
||||
const timeDifference = endTime - startTime;
|
||||
const timeDifferenceInSeconds = timeDifference / 1000;
|
||||
// console.log(`Time difference: ${timeDifferenceInSeconds} seconds`);
|
||||
|
||||
let imageCode;
|
||||
let gameScore;
|
||||
|
||||
if(scoreTotal){
|
||||
gameScore = scoreTotal;
|
||||
}else{
|
||||
gameScore = 0;
|
||||
}
|
||||
// console.log('This is from main point', scoreTotal);
|
||||
drawingZone.renderer.snapshot((image) => {
|
||||
if(gameType[0] == 'drawing'){
|
||||
submitButton.setVisible(true);
|
||||
snapshotButton.setVisible(true);
|
||||
customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = 'my_drawing.png';
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}else if( gameType[0] == "guided-tracing"){
|
||||
// submitButton.setVisible(true);
|
||||
// snapshotButton.setVisible(true);
|
||||
// customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = `guided-tracing-${gameId}.png`;
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}
|
||||
let starValue;
|
||||
if(scoreTotal === maxScore){
|
||||
starValue = 5;
|
||||
} else if(scoreTotal === maxScore - 1){
|
||||
starValue = 4;
|
||||
} else{
|
||||
starValue = 3;
|
||||
}
|
||||
let maxStarValue = 10;
|
||||
let progress = 0;
|
||||
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, you’ve got this!` : '';
|
||||
|
||||
function progressIncrement() {
|
||||
const interval = setInterval(() => {
|
||||
if (progress >= 100) {
|
||||
clearInterval(interval);
|
||||
} else {
|
||||
progress += 10;
|
||||
progressBar.style.width = `${progress}%`;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
progressIncrement();
|
||||
function addStarScalingStyles() {
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = `
|
||||
@keyframes scaleUp {
|
||||
0% {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.star {
|
||||
display: inline-block;
|
||||
transform-origin: center;
|
||||
transform: scale(0); /* Initial state before animation */
|
||||
opacity: 0; /* Initial opacity */
|
||||
animation: scaleUp 0.5s ease forwards;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
addStarScalingStyles();
|
||||
const blankStar = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
loadingMainContainer.style.display = 'flex';
|
||||
|
||||
const loadingDiv = document.getElementById('loadingState');
|
||||
loadingDiv.style.display = 'flex';
|
||||
|
||||
const containerDiv = document.createElement('div');
|
||||
containerDiv.classList.add('w-full');
|
||||
containerDiv.style.display = 'flex';
|
||||
containerDiv.style.flexDirection = 'column';
|
||||
containerDiv.style.justifyContent = 'center';
|
||||
containerDiv.style.alignItems = 'center';
|
||||
|
||||
const paragraph = document.createElement('p');
|
||||
paragraph.textContent = 'HOLD ON.';
|
||||
paragraph.style.fontSize = '16px';
|
||||
paragraph.style.fontWeight = '600';
|
||||
paragraph.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(paragraph);
|
||||
|
||||
const progressBarContainer = document.createElement('div');
|
||||
progressBarContainer.style.position = 'relative';
|
||||
progressBarContainer.style.display = 'flex';
|
||||
progressBarContainer.style.alignItems = 'center';
|
||||
progressBarContainer.style.border = '1px solid #AFB8E6';
|
||||
progressBarContainer.style.height = '10px';
|
||||
progressBarContainer.style.width = '100%';
|
||||
progressBarContainer.style.marginTop = '30px';
|
||||
progressBarContainer.style.marginBottom = '30px';
|
||||
containerDiv.appendChild(progressBarContainer);
|
||||
|
||||
const progressBar = document.createElement('div');
|
||||
progressBar.style.height = '10px';
|
||||
progressBar.style.backgroundColor = '#D7DCF2';
|
||||
progressBar.style.width = '0%';
|
||||
progressBarContainer.appendChild(progressBar);
|
||||
|
||||
loadingDiv.appendChild(containerDiv);
|
||||
|
||||
const calculationText = document.createElement('p');
|
||||
calculationText.textContent = 'Your stars are being calculated...';
|
||||
calculationText.style.fontSize = '14px';
|
||||
calculationText.style.fontWeight = '600';
|
||||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
let userData = {
|
||||
'gameName': gameVersion,
|
||||
'gameID': gameId,
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId,
|
||||
'gameTime' : timeDifferenceInSeconds,
|
||||
'score' : scoreTotal,
|
||||
'gameStar' : starValue
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('wsSavedImg').classList.remove('-z-10');
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
|
||||
// Clear the drawing
|
||||
// graphics.clear();
|
||||
});
|
||||
};
|
|
@ -0,0 +1,243 @@
|
|||
function retryGame(){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const userId = urlParams.get('userId');
|
||||
const gameVersion = urlParams.get('gameName');
|
||||
const gameId = urlParams.get('id');
|
||||
let submitNotic;
|
||||
|
||||
// console.log(userId);
|
||||
let startTime = Date.now();
|
||||
|
||||
|
||||
const url = window.location.href;
|
||||
const gameName = url.split('/');
|
||||
const gameType = gameName[3].split('?id=');
|
||||
// let gameVersion;
|
||||
|
||||
// console.log("Here is game name ", gameType[0])
|
||||
|
||||
// if(gameType[0] == "guided-tracing"){
|
||||
// gameVersion = gameType[0].split('?')[0];
|
||||
// gameId = gameName[4];
|
||||
// console.log('Type - 1');
|
||||
|
||||
// } else if(gameName.length == 4){
|
||||
// gameVersion = gameName[3].split('?')[0];
|
||||
// gameId = urlParams.get('id');
|
||||
// }
|
||||
// else if(gameName.length == 5){
|
||||
// gameVersion = gameName[3] + '-' + gameName[4].split('?')[0];
|
||||
// gameId = urlParams.get('id');
|
||||
// console.log('Type - 2');
|
||||
// }else if(gameName.length == 6){
|
||||
// gameVersion = gameType[0] + '-' + gameName[4];
|
||||
// gameId = urlParams.get('id');
|
||||
// console.log('Type - 3');
|
||||
// }
|
||||
|
||||
console.log(gameVersion)
|
||||
|
||||
function submitUserData(drawingZone) {
|
||||
const endTime = Date.now();
|
||||
const timeDifference = endTime - startTime;
|
||||
const timeDifferenceInSeconds = timeDifference / 1000;
|
||||
// console.log(`Time difference: ${timeDifferenceInSeconds} seconds`);
|
||||
|
||||
let imageCode;
|
||||
let gameScore;
|
||||
|
||||
if(scoreTotal){
|
||||
gameScore = scoreTotal;
|
||||
}else{
|
||||
gameScore = 0;
|
||||
}
|
||||
// console.log('This is from main point', scoreTotal);
|
||||
drawingZone.renderer.snapshot((image) => {
|
||||
if(gameType[0] == 'drawing'){
|
||||
submitButton.setVisible(true);
|
||||
snapshotButton.setVisible(true);
|
||||
customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = 'my_drawing.png';
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}else if( gameType[0] == "guided-tracing"){
|
||||
// submitButton.setVisible(true);
|
||||
// snapshotButton.setVisible(true);
|
||||
// customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = `guided-tracing-${gameId}.png`;
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}
|
||||
let starValue;
|
||||
if(scoreTotal === maxScore){
|
||||
starValue = 5;
|
||||
} else if(scoreTotal === maxScore - 1){
|
||||
starValue = 4;
|
||||
} else{
|
||||
starValue = 3;
|
||||
}
|
||||
let maxStarValue = 10;
|
||||
let progress = 0;
|
||||
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, you’ve got this!` : '';
|
||||
|
||||
function progressIncrement() {
|
||||
const interval = setInterval(() => {
|
||||
if (progress >= 100) {
|
||||
clearInterval(interval);
|
||||
} else {
|
||||
progress += 10;
|
||||
progressBar.style.width = `${progress}%`;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
progressIncrement();
|
||||
function addStarScalingStyles() {
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = `
|
||||
@keyframes scaleUp {
|
||||
0% {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.star {
|
||||
display: inline-block;
|
||||
transform-origin: center;
|
||||
transform: scale(0); /* Initial state before animation */
|
||||
opacity: 0; /* Initial opacity */
|
||||
animation: scaleUp 0.5s ease forwards;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
addStarScalingStyles();
|
||||
const blankStar = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
loadingMainContainer.style.display = 'flex';
|
||||
|
||||
const loadingDiv = document.getElementById('loadingState');
|
||||
loadingDiv.style.display = 'flex';
|
||||
|
||||
const containerDiv = document.createElement('div');
|
||||
containerDiv.classList.add('w-full');
|
||||
containerDiv.style.display = 'flex';
|
||||
containerDiv.style.flexDirection = 'column';
|
||||
containerDiv.style.justifyContent = 'center';
|
||||
containerDiv.style.alignItems = 'center';
|
||||
|
||||
const paragraph = document.createElement('p');
|
||||
paragraph.textContent = 'HOLD ON.';
|
||||
paragraph.style.fontSize = '16px';
|
||||
paragraph.style.fontWeight = '600';
|
||||
paragraph.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(paragraph);
|
||||
|
||||
const progressBarContainer = document.createElement('div');
|
||||
progressBarContainer.style.position = 'relative';
|
||||
progressBarContainer.style.display = 'flex';
|
||||
progressBarContainer.style.alignItems = 'center';
|
||||
progressBarContainer.style.border = '1px solid #AFB8E6';
|
||||
progressBarContainer.style.height = '10px';
|
||||
progressBarContainer.style.width = '100%';
|
||||
progressBarContainer.style.marginTop = '30px';
|
||||
progressBarContainer.style.marginBottom = '30px';
|
||||
containerDiv.appendChild(progressBarContainer);
|
||||
|
||||
const progressBar = document.createElement('div');
|
||||
progressBar.style.height = '10px';
|
||||
progressBar.style.backgroundColor = '#D7DCF2';
|
||||
progressBar.style.width = '0%';
|
||||
progressBarContainer.appendChild(progressBar);
|
||||
|
||||
loadingDiv.appendChild(containerDiv);
|
||||
|
||||
const calculationText = document.createElement('p');
|
||||
calculationText.textContent = 'Your stars are being calculated...';
|
||||
calculationText.style.fontSize = '14px';
|
||||
calculationText.style.fontWeight = '600';
|
||||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
let userData = {
|
||||
'gameName': gameVersion,
|
||||
'gameID': gameId,
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId,
|
||||
'gameTime' : timeDifferenceInSeconds,
|
||||
'score' : scoreTotal,
|
||||
'gameStar' : starValue
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('wsSavedImg').classList.remove('-z-10');
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
|
||||
// Clear the drawing
|
||||
// graphics.clear();
|
||||
});
|
||||
};
|
|
@ -1,15 +1,17 @@
|
|||
function retryGame(){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
|
||||
const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const userId = urlParams.get('userId');
|
||||
const gameVersion = urlParams.get('gameName');
|
||||
const assignmentId = urlParams.get('assignmentId');
|
||||
const worksheetId = urlParams.get('worksheetId');
|
||||
const gameId = urlParams.get('id');
|
||||
let submitNotic;
|
||||
|
||||
console.log(userId);
|
||||
// console.log(userId);
|
||||
let startTime = Date.now();
|
||||
|
||||
|
||||
|
@ -39,8 +41,6 @@ const gameType = gameName[3].split('?id=');
|
|||
// console.log('Type - 3');
|
||||
// }
|
||||
|
||||
console.log(gameVersion)
|
||||
|
||||
function submitUserData(drawingZone) {
|
||||
const endTime = Date.now();
|
||||
const timeDifference = endTime - startTime;
|
||||
|
@ -57,48 +57,44 @@ function submitUserData(drawingZone) {
|
|||
}
|
||||
// console.log('This is from main point', scoreTotal);
|
||||
drawingZone.renderer.snapshot((image) => {
|
||||
if(gameType[0] == 'drawing'){
|
||||
submitButton.setVisible(true);
|
||||
snapshotButton.setVisible(true);
|
||||
customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = 'my_drawing.png';
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}else if( gameType[0] == "guided-tracing"){
|
||||
// submitButton.setVisible(true);
|
||||
// snapshotButton.setVisible(true);
|
||||
// customCursor.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = `guided-tracing-${gameId}.png`;
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}
|
||||
let starValue;
|
||||
if(scoreTotal === maxScore){
|
||||
starValue = 5;
|
||||
} else if(scoreTotal === maxScore - 1){
|
||||
starValue = 4;
|
||||
} else{
|
||||
starValue = 3;
|
||||
}
|
||||
let maxStarValue = 5;
|
||||
submitButton.setVisible(true);
|
||||
image.style.width = '160px';
|
||||
image.style.height = '120px';
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = 'my_drawing.png';
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
let starValue = Math.round((scoreTotal / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
// console.log('Star Value', starValue);
|
||||
// console.log('starValue', starValue)
|
||||
// if(scoreTotal === maxScore){
|
||||
// starValue = 5;
|
||||
// } else if(scoreTotal === maxScore - 1){
|
||||
// starValue = 4;
|
||||
// } else{
|
||||
// starValue = 3;
|
||||
// }
|
||||
let maxStarValue = 10;
|
||||
let progress = 0;
|
||||
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, you’ve got this!` : '';
|
||||
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.";
|
||||
}
|
||||
|
||||
|
||||
function progressIncrement() {
|
||||
const interval = setInterval(() => {
|
||||
|
@ -133,9 +129,9 @@ function submitUserData(drawingZone) {
|
|||
document.head.appendChild(style);
|
||||
}
|
||||
addStarScalingStyles();
|
||||
const blankStar = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
const blankStar = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
const starSVG = `<svg width="48" height="48" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
|
@ -184,60 +180,103 @@ function submitUserData(drawingZone) {
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
let userData = {
|
||||
'gameName': gameVersion,
|
||||
'gameID': gameId,
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId,
|
||||
'gameTime' : timeDifferenceInSeconds,
|
||||
'score' : scoreTotal,
|
||||
'gameStar' : starValue
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameVersion,
|
||||
gameID: gameId,
|
||||
screenShot: imageCode,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGalleryImage`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type' : 'application/json'
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('wsSavedImg').classList.remove('-z-10');
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Gallery Response Data', data)
|
||||
|
||||
if(data.screenshotUrl){
|
||||
let userData = {
|
||||
'gameName': gameVersion,
|
||||
'gameID': gameId,
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId,
|
||||
'gameTime' : timeDifferenceInSeconds,
|
||||
'score' : scoreTotal,
|
||||
'gameStar' : starValue
|
||||
};
|
||||
console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
// console.log('Response Code', response.status)
|
||||
if (response.status == 200) {
|
||||
document.getElementById('saved-toast').classList.remove('hidden');
|
||||
setTimeout(() => {
|
||||
document.getElementById('saved-toast').classList.add('hidden');
|
||||
}, 1500);
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
// starContainer.style.flexDirection = 'row';
|
||||
// document.getElementById('wsSavedImg').classList.remove('-z-10');
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
// const starDiv = document.createElement('div');
|
||||
// starDiv.innerHTML = starSVG;
|
||||
// starContainer.appendChild(starDiv);
|
||||
// starDiv.classList.add('star');
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: data.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
console.log('Starting submissions API call');
|
||||
fetch(`https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken
|
||||
},
|
||||
body: JSON.stringify(userAnotherData)
|
||||
})
|
||||
.then(response => {
|
||||
console.log('Submissions API Response:', response);
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
console.log('Submissions Response Data:', data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error in Submissions API:', error);
|
||||
});
|
||||
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
|
||||
// Clear the drawing
|
||||
// graphics.clear();
|
||||
});
|
||||
console.error('An error occoured', error)
|
||||
})
|
||||
});
|
||||
};
|
|
@ -3,7 +3,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<div class="specific">
|
||||
<section class="bg-white bg-center bg-no-repeat bg-cover h-screen">
|
||||
<div class="shadow-md">
|
||||
<div class="container mx-auto px-4 flex flex-row place-content-between pt-6">
|
||||
|
@ -13,68 +13,77 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div class="flex flex-row space-x-1 pb-2">
|
||||
<button onclick="audioPlayAndPause()"><img src="/assets/svg/mute.svg" alt=""></button>
|
||||
<button onclick="retryGame()"><img src="/assets/svg/reset.svg" alt=""></button>
|
||||
<button onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button id="downloadBtn" onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button onclick="history.back();"><img src="/assets/svg/cancel.svg" alt=""></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
</div> -->
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<form id="contactForm">
|
||||
<div id="itemForm" class="flex flex-row place-content-between gap-4">
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a1" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image1" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label1" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a1" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image1" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label1"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image1');" type="checkbox" id="a1" class="round-checkbox-input myCheckbox largerCheckbox" value="a1"/>
|
||||
<input onclick="checkResult2('image1');" type="checkbox" id="a1" class="round-checkbox-input myCheckbox largerCheckbox " value="a1"/>
|
||||
|
||||
<label for="a2" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image2" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label2" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a2" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image2" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label2"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image2');" type="checkbox" id="a2" class="round-checkbox-input myCheckbox largerCheckbox" value="a2"/>
|
||||
<input onclick="checkResult2('image2');" type="checkbox" id="a2" class="round-checkbox-input myCheckbox largerCheckbox " value="a2"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a3" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image3" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label3" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a3" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image3" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label3"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image3');" type="checkbox" id="a3" class="round-checkbox-input myCheckbox largerCheckbox" value="a3"/>
|
||||
<input onclick="checkResult2('image3');" type="checkbox" id="a3" class="round-checkbox-input myCheckbox largerCheckbox " value="a3"/>
|
||||
|
||||
<label for="a4" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image4" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label4" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a4" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image4" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label4"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image4');" type="checkbox" id="a4" class="round-checkbox-input myCheckbox largerCheckbox" value="a4"/>
|
||||
<input onclick="checkResult2('image4');" type="checkbox" id="a4" class="round-checkbox-input myCheckbox largerCheckbox " value="a4"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a5" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image5" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label5" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a5" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image5" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label5"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image5');" type="checkbox" id="a5" class="round-checkbox-input myCheckbox largerCheckbox" value="a5"/>
|
||||
<input onclick="checkResult2('image5');" type="checkbox" id="a5" class="round-checkbox-input myCheckbox largerCheckbox " value="a5"/>
|
||||
|
||||
<label for="a6" class="round-checkbox-label text-[14px] md:text-2xl">
|
||||
<img id="image6" src="" alt="" draggable="false" class="select-none sm:w-[100px] h-[120px]" />
|
||||
<p id="label6" class="h-[50px] overflow-y-auto"></p>
|
||||
<label for="a6" class="round-checkbox-label">
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image6" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label6"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image6');" type="checkbox" id="a6" class="round-checkbox-input myCheckbox largerCheckbox" value="a6"/>
|
||||
<input onclick="checkResult2('image6');" type="checkbox" id="a6" class="round-checkbox-input myCheckbox largerCheckbox " value="a6"/>
|
||||
</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 1 options.</p>
|
||||
<p class="text-[20px] font-[600] text-[#FFFFFF] bg-[#004aad] px-[20px] py-[10px]" style="display: none;" id="savedMessage"></p>
|
||||
<!-- <p class="text-[20px] font-[600] text-[#FFFFFF] bg-[#004aad] px-[20px] py-[10px]" style="display: none;" id="savedMessage"></p> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute inset-0" style="display: none;" id="allParentDiv">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
|
@ -83,7 +92,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -98,16 +110,17 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div class="clip-art-container absolute bottom-0 right-0 hidden">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<audio id="audioPlayer" controls class="hidden">
|
||||
<source id="instrucAudio1" src="" type="audio/ogg">
|
||||
<source id="instrucAudio2" src="" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -127,6 +140,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let totalPoints = 0;
|
||||
|
@ -135,7 +150,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 6;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -235,6 +250,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
|
||||
|
||||
function saveUserData() {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
const checkboxes = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6'];
|
||||
const checkedCount = checkboxes.filter(id => document.getElementById(id).checked).length;
|
||||
if (checkedCount < 1) {
|
||||
|
@ -270,25 +286,26 @@ import Layout from "../../layouts/Layout.astro";
|
|||
}
|
||||
});
|
||||
|
||||
// Move the userData object creation inside the saveUserData function if needed
|
||||
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, you’ve got this!` : '';
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
const blankStar = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
|
@ -336,52 +353,140 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
|
@ -101,7 +101,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -126,6 +129,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -145,6 +149,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let url = window.location.href;
|
||||
let urlSplit = url.split('/');
|
||||
|
@ -152,7 +158,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let totalPoints = 0;
|
||||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 9;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -306,17 +312,21 @@ 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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -370,52 +380,139 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
|
|
@ -3,7 +3,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<div class="specific">
|
||||
<section class="bg-white bg-center bg-no-repeat bg-cover h-screen">
|
||||
<div class="shadow-md">
|
||||
<div class="container mx-auto px-4 flex flex-row place-content-between pt-6">
|
||||
|
@ -13,68 +13,77 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div class="flex flex-row space-x-1 pb-2">
|
||||
<button onclick="audioPlayAndPause()"><img src="/assets/svg/mute.svg" alt=""></button>
|
||||
<button onclick="retryGame()"><img src="/assets/svg/reset.svg" alt=""></button>
|
||||
<button onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button id="downloadBtn" onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button onclick="history.back();"><img src="/assets/svg/cancel.svg" alt=""></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
</div> -->
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<form id="contactForm">
|
||||
<div id="itemForm" class="flex flex-row place-content-between gap-4">
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a1" class="round-checkbox-label">
|
||||
<img id="image1" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label1" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image1" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label1"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image1');" type="checkbox" id="a1" class="round-checkbox-input myCheckbox largerCheckbox" value="a1"/>
|
||||
<input onclick="checkResult2('image1');" type="checkbox" id="a1" class="round-checkbox-input myCheckbox largerCheckbox " value="a1"/>
|
||||
|
||||
<label for="a2" class="round-checkbox-label">
|
||||
<img id="image2" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label2" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image2" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label2"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image2');" type="checkbox" id="a2" class="round-checkbox-input myCheckbox largerCheckbox" value="a2"/>
|
||||
<input onclick="checkResult2('image2');" type="checkbox" id="a2" class="round-checkbox-input myCheckbox largerCheckbox " value="a2"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a3" class="round-checkbox-label">
|
||||
<img id="image3" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label3" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image3" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label3"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image3');" type="checkbox" id="a3" class="round-checkbox-input myCheckbox largerCheckbox" value="a3"/>
|
||||
<input onclick="checkResult2('image3');" type="checkbox" id="a3" class="round-checkbox-input myCheckbox largerCheckbox " value="a3"/>
|
||||
|
||||
<label for="a4" class="round-checkbox-label">
|
||||
<img id="image4" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label4" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image4" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label4"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image4');" type="checkbox" id="a4" class="round-checkbox-input myCheckbox largerCheckbox" value="a4"/>
|
||||
<input onclick="checkResult2('image4');" type="checkbox" id="a4" class="round-checkbox-input myCheckbox largerCheckbox " value="a4"/>
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 place-items-center">
|
||||
<label for="a5" class="round-checkbox-label">
|
||||
<img id="image5" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label5" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image5" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label5"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image5');" type="checkbox" id="a5" class="round-checkbox-input myCheckbox largerCheckbox" value="a5"/>
|
||||
<input onclick="checkResult2('image5');" type="checkbox" id="a5" class="round-checkbox-input myCheckbox largerCheckbox " value="a5"/>
|
||||
|
||||
<label for="a6" class="round-checkbox-label">
|
||||
<img id="image6" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label6" class="h-[50px] overflow-y-auto"></p>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img id="image6" src="" alt="" draggable="false" class="select-none" />
|
||||
<p id="label6"></p>
|
||||
</div>
|
||||
</label>
|
||||
<input onclick="checkResult2('image6');" type="checkbox" id="a6" class="round-checkbox-input myCheckbox largerCheckbox" value="a6"/>
|
||||
<input onclick="checkResult2('image6');" type="checkbox" id="a6" class="round-checkbox-input myCheckbox largerCheckbox " value="a6"/>
|
||||
</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 1 options.</p>
|
||||
<p class="text-[20px] font-[600] text-[#FFFFFF] bg-[#004aad] px-[20px] py-[10px]" style="display: none;" id="savedMessage"></p>
|
||||
<!-- <p class="text-[20px] font-[600] text-[#FFFFFF] bg-[#004aad] px-[20px] py-[10px]" style="display: none;" id="savedMessage"></p> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute inset-0" style="display: none;" id="allParentDiv">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
|
@ -83,7 +92,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -98,7 +110,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div class="clip-art-container absolute bottom-0 right-0 hidden">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<audio id="audioPlayer" controls class="hidden">
|
||||
<source id="instrucAudio1" src="" type="audio/ogg">
|
||||
|
@ -108,6 +120,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -127,6 +140,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let url = window.location.href;
|
||||
|
@ -135,7 +150,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let totalPoints = 0;
|
||||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 6;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -273,17 +288,21 @@ import Layout from "../../layouts/Layout.astro";
|
|||
}
|
||||
});
|
||||
|
||||
// Move the userData object creation inside the saveUserData function if needed
|
||||
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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -336,53 +355,140 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.fontWeight = '600';
|
||||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
// console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
|
|
@ -18,7 +18,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-3xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<form id="contactForm">
|
||||
<div id="" class="flex flex-row place-content-between ">
|
||||
|
@ -96,7 +96,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -121,6 +124,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -140,6 +144,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let wrongCount = 0;
|
||||
let url = window.location.href;
|
||||
|
@ -148,7 +154,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let maxPoint = 9;
|
||||
let starValue;
|
||||
let totalPoints = 0;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 9;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -291,18 +297,21 @@ 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, you’ve got this!` : '';
|
||||
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -356,52 +365,139 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// Handle error
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// Handle error
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<div class="flex flex-col">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<!-- <p id="LearningSubArea"></p> -->
|
||||
|
@ -71,7 +71,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -96,6 +99,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -115,6 +119,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let totalPoints = 0;
|
||||
|
@ -122,7 +128,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let url = window.location.href;
|
||||
let urlSplit = url.split('/');
|
||||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 3;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -243,17 +249,20 @@ import Layout from "../../layouts/Layout.astro";
|
|||
}
|
||||
});
|
||||
|
||||
totalPoints === 1 ? starValue = 5 : 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, you’ve got this!` : '';
|
||||
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -306,53 +315,140 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.fontWeight = '600';
|
||||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
// console.log(userData);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,14 +3,22 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
</div>
|
||||
</div>
|
||||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -23,18 +31,18 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
</div>
|
||||
<div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
</div>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
</main>
|
||||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -439,7 +447,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
})
|
||||
let blocks1Width1, blocks1Width2, blocks1Width3, blocks1Width4, blocks1Width5, blocks1Width6, blocks1Width7, blocks1Width8;
|
||||
if(audioFileId === true){
|
||||
|
|
|
@ -7,15 +7,21 @@ const numberOfTimes = starNumberOfTime;
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
</div>
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
</div>
|
||||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div class="flex flex-row space-x-4 items-center justify-center ">
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/animate-clipart.gif" alt="" style="width: 90.21px; height: 86.24px;" />
|
||||
|
@ -27,19 +33,19 @@ const numberOfTimes = starNumberOfTime;
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<!-- <div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
</main>
|
||||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -47,7 +53,7 @@ const numberOfTimes = starNumberOfTime;
|
|||
y: window.innerHeight / 4,
|
||||
width: isMobile ? window.innerWidth : window.innerWidth / 2, // Full width on mobile, else 1/2 of screen width
|
||||
height: window.innerHeight / 2,
|
||||
};
|
||||
};
|
||||
let submitButton;
|
||||
let formattedDateTime;
|
||||
let shortUniqueID;
|
||||
|
@ -171,6 +177,7 @@ const numberOfTimes = starNumberOfTime;
|
|||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drag/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
console.log(data)
|
||||
if(data.instruction){
|
||||
audioFileId = true;
|
||||
}
|
||||
|
@ -468,7 +475,7 @@ const numberOfTimes = starNumberOfTime;
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -3,6 +3,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
|
@ -11,7 +15,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -32,10 +39,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -433,7 +440,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
})
|
||||
|
||||
const blocks = [
|
||||
|
|
|
@ -3,18 +3,24 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
</div>
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
</div>
|
||||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div class="flex flex-row space-x-4 items-center justify-center ">
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
<img class="z-10" src="/assets/animate-clipart.gif" alt="" style="width: 90.21px; height: 86.24px;" />
|
||||
<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">
|
||||
|
@ -23,19 +29,19 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
<!-- <div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div> -->
|
||||
</div>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
</main>
|
||||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -433,7 +439,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
})
|
||||
|
||||
const blocks = [
|
||||
|
|
|
@ -3,6 +3,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
|
@ -11,7 +15,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -32,10 +39,10 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -462,7 +469,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
})
|
||||
|
||||
|
||||
|
@ -522,27 +529,16 @@ import Layout from '../../layouts/Layout.astro';
|
|||
let counter = 0;
|
||||
|
||||
const isMatch = (blockName, targetName) => {
|
||||
if(isMatch){
|
||||
counter++;
|
||||
// console.log(counter)
|
||||
}
|
||||
//resultView scoreTotal
|
||||
const match = blockMatches.find((m) => m.blockName === blockName && m.targetName === targetName);
|
||||
// console.log(match)
|
||||
if (match !== undefined) {
|
||||
const match = blockMatches.find((m) => m.blockName === blockName && m.targetName === targetName);
|
||||
if (match !== undefined) {
|
||||
scoreTotal++;
|
||||
counter++;
|
||||
// console.log(`Score Total: ${scoreTotal}`);
|
||||
return 'borderCorrect';
|
||||
} else {
|
||||
console.log(`Score Total: ${scoreTotal}`);
|
||||
// console.log(`Score Total: ${scoreTotal}`);
|
||||
return 'borderWrong';
|
||||
}
|
||||
|
||||
// if(counter === 8){
|
||||
// // console.log(counter)
|
||||
// submitButton.setVisible(true);
|
||||
// retryButton.setVisible(true);
|
||||
// }
|
||||
};
|
||||
|
||||
const droppedBlocks = [];
|
||||
|
|
|
@ -3,14 +3,22 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title="Drag Game">
|
||||
<main>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div>
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16">
|
||||
</div>
|
||||
</div>
|
||||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -22,19 +30,19 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wsSavedImg" class="clip-art-container absolute -z-10 bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
<div id="wsSavedImg" class="clip-art-container -z-10 absolute bottom-0 right-0">
|
||||
<img src="/assets/svg/clip-art2.svg" alt="Clip Art" class="clip-art">
|
||||
</div>
|
||||
</div>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
</main>
|
||||
</Layout>
|
||||
<script src="/saveGameData.js" is:inline></script>
|
||||
<script is:inline>
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
}
|
||||
// function showAnimation() {
|
||||
// const clipArt = document.querySelector('.clip-art');
|
||||
// clipArt.classList.add('show');
|
||||
// }
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
const drawingZone = {
|
||||
|
@ -441,7 +449,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// window.location.reload();
|
||||
// windowLoad();
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
// showAnimation();
|
||||
})
|
||||
// this.add.image(displayW / 2, displayH / 2, "bg").setScale(2.4);
|
||||
|
||||
|
@ -594,7 +602,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// console.log(match)
|
||||
if(match !== undefined){
|
||||
scoreTotal++;
|
||||
console.log("Score Total", scoreTotal)
|
||||
// console.log("Score Total", scoreTotal)
|
||||
}
|
||||
if(counter === 8){
|
||||
// console.log(counter)
|
||||
|
|
|
@ -3,6 +3,14 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title='Drawing Game'>
|
||||
<main>
|
||||
<audio id="savedAudioMessage">
|
||||
<source src="/assets/ws-saved.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div id="parentMainContainer"class="hidden">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute z-10" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
|
@ -18,30 +26,31 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
<div class="flex flex-col w-full max-w-sm items-center justify-center mx-auto gap-3">
|
||||
<button onclick="history.back();" class="rounded-[4px] bg-[#0348A8] text-[#FFF] text-[12px] font-[700] p-2.5 w-full border-[1px] border-[#0348A8]">Wow, Lets Go</button>
|
||||
<button onclick="retryGame()" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
<button onclick="retryGame();" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clip-art-container absolute bottom-10 right-10" id="bottomAnimateClipart">
|
||||
<div class="flex flex-row z-50 place-items-end clip-art">
|
||||
<img src="/assets/clip-art-with-hand.svg" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[10px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img id="clipArtWithHand" src="" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[20px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Left Star" class="absolute left-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Right Star" class="absolute right-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex flex-col space-y-3 px-10 py-10 w-[348px] h-[187px] ">
|
||||
<p class="text-center text-[14px] font-[600] text-[#394FC0]">Want to find how much stars you’ve earned?</p>
|
||||
<button class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();" >Ask to Beanie</button>
|
||||
<button id="buddiesName" class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();"></button>
|
||||
<a href="" class="text-center text-[12px] font-[600] text-[#394FC0] underline decoration-2 underline-offset-[4px]">Skip</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gallerySliderId" class="hidden p-2 z-10 absolute inset-0 bg-black w-full h-screen bg-opacity-50 flex justify-center items-center">
|
||||
<div class="w-full max-w-3xl lg:max-w-4xl 2xl:max-w-6xl bg-white rounded-lg">
|
||||
<div class="flex justify-between p-3">
|
||||
<p class="text-[19px] font-[700]">Attempt 2</p>
|
||||
<p id="attemptCount" class="text-[19px] font-[700]"></p>
|
||||
<button onclick="closeGallery();"> <img src="/assets/svg/crossIcon.svg"></button>
|
||||
</div>
|
||||
<div class="relative w-full aspect-video overflow-hidden rounded-b-lg shadow-lg">
|
||||
|
@ -59,35 +68,59 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameAI.js" is:inline></script>
|
||||
<script is:inline>
|
||||
const jsonData = [
|
||||
{
|
||||
"src": "/assets/back.jpeg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/background.jpg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/backgroundImage.png"
|
||||
},
|
||||
{
|
||||
"src": "/assets/beanieImage.png"
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const akademyUserId = params.get('userId');
|
||||
const akademyGameName = params.get('gameName');
|
||||
const spriteNames = params.get('spriteName');
|
||||
|
||||
let buddiesList = [ "arlo", "ava", "dax", "kai", "monstero", "yara" ]
|
||||
function displaySprite() {
|
||||
if (buddiesList.includes(spriteNames)) {
|
||||
const imgElement = document.getElementById('clipArtWithHand');
|
||||
document.getElementById('buddiesName').textContent = `Ask to ${spriteNames.charAt(0).toUpperCase() + spriteNames.slice(1)}`;
|
||||
if (imgElement) {
|
||||
imgElement.src = `/assets/hand-${spriteNames}.svg`;
|
||||
console.log(imgElement.src)
|
||||
} else {
|
||||
console.log('Element with ID "clipArtWithHand" not found.');
|
||||
}
|
||||
} else {
|
||||
console.log('Sprite not found in the list.');
|
||||
}
|
||||
}
|
||||
|
||||
displaySprite();
|
||||
|
||||
let galleryData = []; // Store gallery data from the API
|
||||
let currentSlide = 0; // Initialize the current slide index
|
||||
fetch(`http://localhost:5175/api/getGalleryImage?userId=${akademyUserId}&gameID=${paramsID}&gameName=${akademyGameName}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
galleryData = data; // Store the fetched gallery data
|
||||
updateSlide(); // Call updateSlide after the data is fetched
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
function updateSlide() {
|
||||
if (galleryData.length > 0) {
|
||||
document.getElementById('attemptCount').textContent = `Attempt ${currentSlide + 1}`;
|
||||
const slide = galleryData[currentSlide]; // Get the current slide's data
|
||||
document.getElementById('slideImage').src = slide.screenshotUrl; // Update the image source
|
||||
}
|
||||
];
|
||||
let currentSlide = 0;
|
||||
function updateSlide(){
|
||||
const slide = jsonData[currentSlide];
|
||||
document.getElementById('slideImage').src = slide.src;
|
||||
}
|
||||
document.getElementById('nextButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide + 1) % jsonData.length;
|
||||
console.log(currentSlide)
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide + 1) % galleryData.length; // Move to the next slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
document.getElementById('prevButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide - 1 + jsonData.length) % jsonData.length;
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide - 1 + galleryData.length) % galleryData.length; // Move to the previous slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
|
||||
updateSlide();
|
||||
|
||||
let parentMainContainer = document.getElementById('parentMainContainer');
|
||||
let gallerySliderId = document.getElementById('gallerySliderId');
|
||||
function closeGallery(){
|
||||
|
@ -187,8 +220,6 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// shortUniqueID = generateShortUniqueID(10); // Change 10 to the desired length
|
||||
// console.log(shortUniqueID);
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/drawing_phonics/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
|
@ -320,6 +351,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
submitButton.setInteractive().on('pointerdown', () => {
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
document.getElementById('savedAudioMessage').play();
|
||||
parentMainContainer.classList.remove('hidden');
|
||||
if(isMobile){
|
||||
colorContainer.style.display = 'none';
|
||||
|
|
|
@ -3,6 +3,14 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title='Drawing Game'>
|
||||
<main>
|
||||
<audio id="savedAudioMessage">
|
||||
<source src="/assets/ws-saved.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div id="parentMainContainer"class="hidden">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute z-10" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
|
@ -18,30 +26,31 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
<div class="flex flex-col w-full max-w-sm items-center justify-center mx-auto gap-3">
|
||||
<button onclick="history.back();" class="rounded-[4px] bg-[#0348A8] text-[#FFF] text-[12px] font-[700] p-2.5 w-full border-[1px] border-[#0348A8]">Wow, Lets Go</button>
|
||||
<button onclick="retryGame()" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
<button onclick="retryGame();" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clip-art-container absolute bottom-10 right-10" id="bottomAnimateClipart">
|
||||
<div class="flex flex-row z-50 place-items-end clip-art">
|
||||
<img src="/assets/clip-art-with-hand.svg" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[10px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img id="clipArtWithHand" src="" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[20px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Left Star" class="absolute left-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Right Star" class="absolute right-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex flex-col space-y-3 px-10 py-10 w-[348px] h-[187px] ">
|
||||
<p class="text-center text-[14px] font-[600] text-[#394FC0]">Want to find how much stars you’ve earned?</p>
|
||||
<button class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();" >Ask to Beanie</button>
|
||||
<button id="buddiesName" class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();"></button>
|
||||
<a href="" class="text-center text-[12px] font-[600] text-[#394FC0] underline decoration-2 underline-offset-[4px]">Skip</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gallerySliderId" class="hidden p-2 z-10 absolute inset-0 bg-black w-full h-screen bg-opacity-50 flex justify-center items-center">
|
||||
<div class="w-full max-w-3xl lg:max-w-4xl 2xl:max-w-6xl bg-white rounded-lg">
|
||||
<div class="flex justify-between p-3">
|
||||
<p class="text-[19px] font-[700]">Attempt 2</p>
|
||||
<p id="attemptCount" class="text-[19px] font-[700]"></p>
|
||||
<button onclick="closeGallery();"> <img src="/assets/svg/crossIcon.svg"></button>
|
||||
</div>
|
||||
<div class="relative w-full aspect-video overflow-hidden rounded-b-lg shadow-lg">
|
||||
|
@ -59,34 +68,56 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameAI.js" is:inline></script>
|
||||
<script is:inline>
|
||||
const jsonData = [
|
||||
{
|
||||
"src": "/assets/back.jpeg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/background.jpg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/backgroundImage.png"
|
||||
},
|
||||
{
|
||||
"src": "/assets/beanieImage.png"
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const akademyUserId = params.get('userId');
|
||||
const akademyGameName = params.get('gameName');
|
||||
const spriteNames = params.get('spriteName');
|
||||
let buddiesList = [ "arlo", "ava", "dax", "kai", "monstero", "yara" ]
|
||||
function displaySprite() {
|
||||
if (buddiesList.includes(spriteNames)) {
|
||||
const imgElement = document.getElementById('clipArtWithHand');
|
||||
document.getElementById('buddiesName').textContent = `Ask to ${spriteNames.charAt(0).toUpperCase() + spriteNames.slice(1)}`;
|
||||
if (imgElement) {
|
||||
imgElement.src = `/assets/hand-${spriteNames}.svg`;
|
||||
console.log(imgElement.src)
|
||||
} else {
|
||||
console.log('Element with ID "clipArtWithHand" not found.');
|
||||
}
|
||||
} else {
|
||||
console.log('Sprite not found in the list.');
|
||||
}
|
||||
}
|
||||
|
||||
displaySprite();
|
||||
|
||||
let galleryData = []; // Store gallery data from the API
|
||||
let currentSlide = 0; // Initialize the current slide index
|
||||
fetch(`http://localhost:5175/api/getGalleryImage?userId=${akademyUserId}&gameID=${paramsID}&gameName=${akademyGameName}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
galleryData = data; // Store the fetched gallery data
|
||||
updateSlide(); // Call updateSlide after the data is fetched
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
function updateSlide() {
|
||||
if (galleryData.length > 0) {
|
||||
document.getElementById('attemptCount').textContent = `Attempt ${currentSlide + 1}`;
|
||||
const slide = galleryData[currentSlide]; // Get the current slide's data
|
||||
document.getElementById('slideImage').src = slide.screenshotUrl; // Update the image source
|
||||
}
|
||||
];
|
||||
let currentSlide = 0;
|
||||
function updateSlide(){
|
||||
const slide = jsonData[currentSlide];
|
||||
document.getElementById('slideImage').src = slide.src;
|
||||
}
|
||||
document.getElementById('nextButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide + 1) % jsonData.length;
|
||||
console.log(currentSlide)
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide + 1) % galleryData.length; // Move to the next slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
document.getElementById('prevButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide - 1 + jsonData.length) % jsonData.length;
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide - 1 + galleryData.length) % galleryData.length; // Move to the previous slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
|
||||
updateSlide();
|
||||
let parentMainContainer = document.getElementById('parentMainContainer');
|
||||
let gallerySliderId = document.getElementById('gallerySliderId');
|
||||
|
@ -188,8 +219,6 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// shortUniqueID = generateShortUniqueID(10); // Change 10 to the desired length
|
||||
// console.log(shortUniqueID);
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/drawing_writo/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
|
@ -324,6 +353,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
submitButton.setInteractive().on('pointerdown', () => {
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
document.getElementById('savedAudioMessage').play();
|
||||
parentMainContainer.classList.remove('hidden');
|
||||
if(isMobile){
|
||||
colorContainer.style.display = 'none';
|
||||
|
|
|
@ -3,6 +3,14 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title='Drawing Game'>
|
||||
<main>
|
||||
<audio id="savedAudioMessage">
|
||||
<source src="/assets/ws-saved.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div id="parentMainContainer"class="hidden">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute z-10" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
|
@ -22,26 +30,27 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clip-art-container absolute bottom-10 right-10" id="bottomAnimateClipart">
|
||||
<div class="flex flex-row z-50 place-items-end clip-art">
|
||||
<img src="/assets/clip-art-with-hand.svg" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[10px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img id="clipArtWithHand" src="" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[20px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Left Star" class="absolute left-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Right Star" class="absolute right-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex flex-col space-y-3 px-10 py-10 w-[348px] h-[187px] ">
|
||||
<p class="text-center text-[14px] font-[600] text-[#394FC0]">Want to find how much stars you’ve earned?</p>
|
||||
<button class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();" >Ask to Beanie</button>
|
||||
<button id="buddiesName" class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();"></button>
|
||||
<a href="" class="text-center text-[12px] font-[600] text-[#394FC0] underline decoration-2 underline-offset-[4px]">Skip</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gallerySliderId" class="hidden p-2 z-10 absolute inset-0 bg-black w-full h-screen bg-opacity-50 flex justify-center items-center">
|
||||
<div class="w-full max-w-3xl lg:max-w-4xl 2xl:max-w-6xl bg-white rounded-lg">
|
||||
<div class="flex justify-between p-3">
|
||||
<p class="text-[19px] font-[700]">Attempt 2</p>
|
||||
<p id="attemptCount" class="text-[19px] font-[700]"></p>
|
||||
<button onclick="closeGallery();"> <img src="/assets/svg/crossIcon.svg"></button>
|
||||
</div>
|
||||
<div class="relative w-full aspect-video overflow-hidden rounded-b-lg shadow-lg">
|
||||
|
@ -56,45 +65,74 @@ import Layout from '../../layouts/Layout.astro';
|
|||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||
<script is:inline src="/assets/js/phaser_3.60.0.js"></script>
|
||||
</main>
|
||||
<!-- http://localhost:2022/drawing/?id=525&userId=6746c2e9cd3b551fae55cb67&gameName=birdWS1 -->
|
||||
</Layout>
|
||||
<script src="/saveGameAI.js" is:inline></script>
|
||||
<script is:inline>
|
||||
// const findBuddies = JSON.parse(localStorage.getItem('userChildDetails') || '{}');
|
||||
// const buddiesName = findBuddies.metadata.sprite
|
||||
|
||||
const retrievedData = localStorage.getItem('akademyPlans')
|
||||
const parsedObject = JSON.parse(retrievedData);
|
||||
|
||||
console.log('buddName', window.location.href);
|
||||
const jsonData = [
|
||||
{
|
||||
"src": "/assets/back.jpeg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/background.jpg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/backgroundImage.png"
|
||||
},
|
||||
{
|
||||
"src": "/assets/beanieImage.png"
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const akademyUserId = params.get('userId');
|
||||
const akademyGameName = params.get('gameName');
|
||||
const spriteNames = params.get('spriteName');
|
||||
let buddiesList = [ "arlo", "ava", "dax", "kai", "monstero", "yara" ]
|
||||
function displaySprite() {
|
||||
if (buddiesList.includes(spriteNames)) {
|
||||
const imgElement = document.getElementById('clipArtWithHand');
|
||||
document.getElementById('buddiesName').textContent = `Ask to ${spriteNames.charAt(0).toUpperCase() + spriteNames.slice(1)}`;
|
||||
if (imgElement) {
|
||||
imgElement.src = `/assets/hand-${spriteNames}.svg`;
|
||||
console.log(imgElement.src)
|
||||
} else {
|
||||
console.log('Element with ID "clipArtWithHand" not found.');
|
||||
}
|
||||
} else {
|
||||
console.log('Sprite not found in the list.');
|
||||
}
|
||||
}
|
||||
|
||||
displaySprite();
|
||||
|
||||
// const jsonData = galleryData;
|
||||
// const jsonData = [
|
||||
// {
|
||||
// "image": "/assets/back.jpeg"
|
||||
// },
|
||||
// {
|
||||
// "image": "/assets/background.jpg"
|
||||
// },
|
||||
// {
|
||||
// "image": "/assets/backgroundImage.png"
|
||||
// },
|
||||
// {
|
||||
// "image": "/assets/beanieImage.png"
|
||||
// }
|
||||
// ];
|
||||
let galleryData = []; // Store gallery data from the API
|
||||
let currentSlide = 0; // Initialize the current slide index
|
||||
fetch(`http://localhost:5175/api/getGalleryImage?userId=${akademyUserId}&gameID=${paramsID}&gameName=${akademyGameName}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
galleryData = data; // Store the fetched gallery data
|
||||
updateSlide(); // Call updateSlide after the data is fetched
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
function updateSlide() {
|
||||
if (galleryData.length > 0) {
|
||||
document.getElementById('attemptCount').textContent = `Attempt ${currentSlide + 1}`;
|
||||
const slide = galleryData[currentSlide]; // Get the current slide's data
|
||||
document.getElementById('slideImage').src = slide.screenshotUrl; // Update the image source
|
||||
}
|
||||
];
|
||||
let currentSlide = 0;
|
||||
function updateSlide(){
|
||||
const slide = jsonData[currentSlide];
|
||||
document.getElementById('slideImage').src = slide.src;
|
||||
}
|
||||
document.getElementById('nextButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide + 1) % jsonData.length;
|
||||
console.log(currentSlide)
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide + 1) % galleryData.length; // Move to the next slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
document.getElementById('prevButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide - 1 + jsonData.length) % jsonData.length;
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide - 1 + galleryData.length) % galleryData.length; // Move to the previous slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
|
||||
updateSlide();
|
||||
let parentMainContainer = document.getElementById('parentMainContainer');
|
||||
let gallerySliderId = document.getElementById('gallerySliderId');
|
||||
|
@ -105,8 +143,13 @@ const parsedObject = JSON.parse(retrievedData);
|
|||
}
|
||||
function showAnimation() {
|
||||
const clipArt = document.querySelector('.clip-art');
|
||||
clipArt.classList.add('show');
|
||||
|
||||
// Initially set the clip-art to show after 2 seconds with a slide effect
|
||||
setTimeout(() => {
|
||||
clipArt.classList.add('show'); // Add the show class to trigger animation
|
||||
}, 2000); // Delay animation by 2 seconds
|
||||
}
|
||||
|
||||
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
|
||||
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
|
||||
|
||||
|
@ -199,8 +242,6 @@ const parsedObject = JSON.parse(retrievedData);
|
|||
// shortUniqueID = generateShortUniqueID(10); // Change 10 to the desired length
|
||||
// console.log(shortUniqueID);
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drawing/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
|
@ -333,6 +374,7 @@ const parsedObject = JSON.parse(retrievedData);
|
|||
submitButton.setInteractive().on('pointerdown', () => {
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
document.getElementById('savedAudioMessage').play();
|
||||
parentMainContainer.classList.remove('hidden');
|
||||
if(isMobile){
|
||||
colorContainer.style.display = 'none';
|
||||
|
@ -944,39 +986,6 @@ const parsedObject = JSON.parse(retrievedData);
|
|||
customCursor.strokePath();
|
||||
}
|
||||
}
|
||||
|
||||
// function update() {
|
||||
// const slider = document.querySelector('input[type="range"]');
|
||||
|
||||
// if (slider && !isDrawing) {
|
||||
// const sliderValue = parseInt(slider.value);
|
||||
// const max = parseInt(slider.max);
|
||||
// const width = slider.offsetWidth;
|
||||
// const offsetX = (sliderValue - 2) / (max - 2) * width;
|
||||
// slider.style.background = `linear-gradient(to right, #000 0%, #000 ${offsetX}px, #fff ${offsetX}px, #fff 100%)`;
|
||||
// }
|
||||
|
||||
// const cursorSize = brushSize * cursorSizeMultiplier;
|
||||
// const cursorScale = 1; // Adjust this value to increase/decrease the cursor size
|
||||
|
||||
// // Assuming 'this' refers to your Phaser.Scene instance
|
||||
// if (!this.customCursor) {
|
||||
// // Create the custom cursor sprite
|
||||
// this.customCursor = this.add.sprite(0, 0, 'cursorImage'); // Replace 'yourCursorImage' with the key of your loaded PNG image
|
||||
// this.customCursor.setOrigin(0.3, 0.8);
|
||||
// }
|
||||
|
||||
// // Set the tint or fill color dynamically based on the selectedColor
|
||||
// const color = Phaser.Display.Color.HexStringToColor(selectedColor).color;
|
||||
// this.customCursor.setTint(color);
|
||||
|
||||
// // Resize the cursor
|
||||
// this.customCursor.setScale( cursorScale);
|
||||
|
||||
// // Position the cursor at the current mouse pointer coordinates
|
||||
// this.customCursor.x = this.input.x;
|
||||
// this.customCursor.y = this.input.y;
|
||||
// }
|
||||
</script>
|
||||
<style>
|
||||
.clear-button {
|
||||
|
@ -999,19 +1008,24 @@ const parsedObject = JSON.parse(retrievedData);
|
|||
}
|
||||
|
||||
.clip-art {
|
||||
transform: translateX(100%); /* Initially off-screen to the right */
|
||||
opacity: 0; /* Initially hidden */
|
||||
transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out; /* Smooth transition */
|
||||
opacity: 0; /* Initially transparent */
|
||||
transform: translateX(100%); /* Start off-screen to the right */
|
||||
transition: transform 1s ease, opacity 1s ease; /* Smooth transition */
|
||||
}
|
||||
|
||||
.clip-art.show {
|
||||
transform: translateX(0); /* Move the image into view */
|
||||
opacity: 1; /* Fade in */
|
||||
transform: translateX(0); /* Slide in from the right */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.slide{
|
||||
display: none;
|
||||
}
|
||||
.active{
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
</style>
|
||||
|
|
|
@ -3,6 +3,14 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title='Drawing Game'>
|
||||
<main>
|
||||
<audio id="savedAudioMessage">
|
||||
<source src="/assets/ws-saved.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div id="parentMainContainer"class="hidden">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute z-10" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
|
@ -18,30 +26,31 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
<div class="flex flex-col w-full max-w-sm items-center justify-center mx-auto gap-3">
|
||||
<button onclick="history.back();" class="rounded-[4px] bg-[#0348A8] text-[#FFF] text-[12px] font-[700] p-2.5 w-full border-[1px] border-[#0348A8]">Wow, Lets Go</button>
|
||||
<button onclick="retryGame()" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
<button onclick="retryGame();" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clip-art-container absolute bottom-10 right-10" id="bottomAnimateClipart">
|
||||
<div class="flex flex-row z-50 place-items-end clip-art">
|
||||
<img src="/assets/clip-art-with-hand.svg" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[10px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img id="clipArtWithHand" src="" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[20px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Left Star" class="absolute left-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Right Star" class="absolute right-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex flex-col space-y-3 px-10 py-10 w-[348px] h-[187px] ">
|
||||
<p class="text-center text-[14px] font-[600] text-[#394FC0]">Want to find how much stars you’ve earned?</p>
|
||||
<button class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();" >Ask to Beanie</button>
|
||||
<button id="buddiesName" class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();"></button>
|
||||
<a href="" class="text-center text-[12px] font-[600] text-[#394FC0] underline decoration-2 underline-offset-[4px]">Skip</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gallerySliderId" class="hidden p-2 z-10 absolute inset-0 bg-black w-full h-screen bg-opacity-50 flex justify-center items-center">
|
||||
<div class="w-full max-w-3xl lg:max-w-4xl 2xl:max-w-6xl bg-white rounded-lg">
|
||||
<div class="flex justify-between p-3">
|
||||
<p class="text-[19px] font-[700]">Attempt 2</p>
|
||||
<p id="attemptCount" class="text-[19px] font-[700]"></p>
|
||||
<button onclick="closeGallery();"> <img src="/assets/svg/crossIcon.svg"></button>
|
||||
</div>
|
||||
<div class="relative w-full aspect-video overflow-hidden rounded-b-lg shadow-lg">
|
||||
|
@ -59,34 +68,56 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameAI.js" is:inline></script>
|
||||
<script is:inline>
|
||||
const jsonData = [
|
||||
{
|
||||
"src": "/assets/back.jpeg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/background.jpg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/backgroundImage.png"
|
||||
},
|
||||
{
|
||||
"src": "/assets/beanieImage.png"
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const akademyUserId = params.get('userId');
|
||||
const akademyGameName = params.get('gameName');
|
||||
const spriteNames = params.get('spriteName');
|
||||
let buddiesList = [ "arlo", "ava", "dax", "kai", "monstero", "yara" ]
|
||||
function displaySprite() {
|
||||
if (buddiesList.includes(spriteNames)) {
|
||||
const imgElement = document.getElementById('clipArtWithHand');
|
||||
document.getElementById('buddiesName').textContent = `Ask to ${spriteNames.charAt(0).toUpperCase() + spriteNames.slice(1)}`;
|
||||
if (imgElement) {
|
||||
imgElement.src = `/assets/hand-${spriteNames}.svg`;
|
||||
console.log(imgElement.src)
|
||||
} else {
|
||||
console.log('Element with ID "clipArtWithHand" not found.');
|
||||
}
|
||||
} else {
|
||||
console.log('Sprite not found in the list.');
|
||||
}
|
||||
}
|
||||
|
||||
displaySprite();
|
||||
|
||||
let galleryData = []; // Store gallery data from the API
|
||||
let currentSlide = 0; // Initialize the current slide index
|
||||
fetch(`http://localhost:5175/api/getGalleryImage?userId=${akademyUserId}&gameID=${paramsID}&gameName=${akademyGameName}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
galleryData = data; // Store the fetched gallery data
|
||||
updateSlide(); // Call updateSlide after the data is fetched
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
function updateSlide() {
|
||||
if (galleryData.length > 0) {
|
||||
document.getElementById('attemptCount').textContent = `Attempt ${currentSlide + 1}`;
|
||||
const slide = galleryData[currentSlide]; // Get the current slide's data
|
||||
document.getElementById('slideImage').src = slide.screenshotUrl; // Update the image source
|
||||
}
|
||||
];
|
||||
let currentSlide = 0;
|
||||
function updateSlide(){
|
||||
const slide = jsonData[currentSlide];
|
||||
document.getElementById('slideImage').src = slide.src;
|
||||
}
|
||||
document.getElementById('nextButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide + 1) % jsonData.length;
|
||||
console.log(currentSlide)
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide + 1) % galleryData.length; // Move to the next slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
document.getElementById('prevButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide - 1 + jsonData.length) % jsonData.length;
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide - 1 + galleryData.length) % galleryData.length; // Move to the previous slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
|
||||
updateSlide();
|
||||
let parentMainContainer = document.getElementById('parentMainContainer');
|
||||
let gallerySliderId = document.getElementById('gallerySliderId');
|
||||
|
@ -205,8 +236,6 @@ import Layout from '../../layouts/Layout.astro';
|
|||
return result;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drawing_v2/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
|
@ -373,6 +402,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
submitButton.setInteractive().on('pointerdown', () => {
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
document.getElementById('savedAudioMessage').play();
|
||||
parentMainContainer.classList.remove('hidden');
|
||||
if(isMobile){
|
||||
colorContainer.style.display = 'none';
|
||||
|
|
|
@ -3,6 +3,14 @@ import Layout from '../../layouts/Layout.astro';
|
|||
---
|
||||
<Layout title='Drawing Game'>
|
||||
<main>
|
||||
<audio id="savedAudioMessage">
|
||||
<source src="/assets/ws-saved.mp3" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
<div id="saved-toast" class="hidden inline-flex items-center gap-3 py-3 px-6 absolute bottom-[50px] left-1/2 transform -translate-x-1/2 -translate-y-1/2 border-[1px] border-[#DBF4E9] rounded-[4px] bg-[#EEFBF6] text-[18px] font-[600] text-[#52555E]" style="box-shadow: -1px 6px 15px 0px #9ED6C040;">
|
||||
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9934 9.55422 24.6216 6.25145 22.1851 3.81491C19.7486 1.37837 16.4458 0.00660747 13 0ZM19.1875 10.725L11.8625 17.725C11.6731 17.9031 11.4225 18.0016 11.1625 18C11.0354 18.0018 10.9093 17.9785 10.7913 17.9313C10.6733 17.8841 10.5658 17.814 10.475 17.725L6.81251 14.225C6.71092 14.1364 6.62831 14.0281 6.56963 13.9067C6.51095 13.7854 6.47741 13.6534 6.47104 13.5187C6.46467 13.3841 6.48559 13.2495 6.53255 13.1231C6.57951 12.9968 6.65154 12.8812 6.7443 12.7834C6.83706 12.6856 6.94865 12.6075 7.07235 12.5539C7.19605 12.5003 7.32931 12.4723 7.46412 12.4715C7.59893 12.4707 7.7325 12.4972 7.85682 12.5493C7.98113 12.6015 8.09361 12.6783 8.18751 12.775L11.1625 15.6125L17.8125 9.275C18.0069 9.10536 18.2594 9.01745 18.5172 9.02964C18.7749 9.04184 19.018 9.1532 19.1955 9.34044C19.3731 9.52767 19.4714 9.7763 19.4699 10.0343C19.4684 10.2924 19.3672 10.5398 19.1875 10.725Z" fill="#6AD0A1"/></svg>
|
||||
Worksheet saved successfully
|
||||
</div>
|
||||
<div id="parentMainContainer"class="hidden">
|
||||
<div id="loadingMainContainer" class="w-full h-screen bg-[#00000070] absolute z-10" style="display: none;">
|
||||
<div id="loadingState" style="display: none;" class="bg-white flex text-[#000] absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] items-center space-y-2 w-full px-6 py-16"></div>
|
||||
|
@ -18,30 +26,31 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</div>
|
||||
<div class="flex flex-col w-full max-w-sm items-center justify-center mx-auto gap-3">
|
||||
<button onclick="history.back();" class="rounded-[4px] bg-[#0348A8] text-[#FFF] text-[12px] font-[700] p-2.5 w-full border-[1px] border-[#0348A8]">Wow, Lets Go</button>
|
||||
<button onclick="retryGame()" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
<button onclick="retryGame();" class="border-[1px] border-[#0348A8] p-2.5 rounded-[4px] text-[#0348A8] w-full">Try Again</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clip-art-container absolute bottom-10 right-10" id="bottomAnimateClipart">
|
||||
<div class="flex flex-row z-50 place-items-end clip-art">
|
||||
<img src="/assets/clip-art-with-hand.svg" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[10px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img id="clipArtWithHand" src="" alt="Clip Art" class="">
|
||||
<div class="relative bg-yellow-500 rounded-[4px] -ml-[20px]" style="background: linear-gradient(74.79deg, #E8EBFF 4.63%, #DDC9F1 97.93%); height: 200px; box-shadow: 0px 4px 8px 3px #CAD1F5;">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Left Star" class="absolute left-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
<img src="/assets/svg/bg-star.svg" alt="Right Star" class="absolute right-0 top-1/4 transform -translate-y-1/2 w-12 h-12">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex flex-col space-y-3 px-10 py-10 w-[348px] h-[187px] ">
|
||||
<p class="text-center text-[14px] font-[600] text-[#394FC0]">Want to find how much stars you’ve earned?</p>
|
||||
<button class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();" >Ask to Beanie</button>
|
||||
<button id="buddiesName" class="text-[12px] font-[700] text-white bg-[#394FC0] rounded-[4px] w-full py-2.5" onclick="calculateFromAI();"></button>
|
||||
<a href="" class="text-center text-[12px] font-[600] text-[#394FC0] underline decoration-2 underline-offset-[4px]">Skip</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="gallerySliderId" class="hidden p-2 z-10 absolute inset-0 bg-black w-full h-screen bg-opacity-50 flex justify-center items-center">
|
||||
<div class="w-full max-w-3xl lg:max-w-4xl 2xl:max-w-6xl bg-white rounded-lg">
|
||||
<div class="flex justify-between p-3">
|
||||
<p class="text-[19px] font-[700]">Attempt 2</p>
|
||||
<p id="attemptCount" class="text-[19px] font-[700]"></p>
|
||||
<button onclick="closeGallery();"> <img src="/assets/svg/crossIcon.svg"></button>
|
||||
</div>
|
||||
<div class="relative w-full aspect-video overflow-hidden rounded-b-lg shadow-lg">
|
||||
|
@ -49,11 +58,6 @@ import Layout from '../../layouts/Layout.astro';
|
|||
|
||||
<button id="prevButton" class="flex justify-center items-center w-[40px] h-[40px] absolute left-4 top-1/2 transform -translate-y-1/2 bg-[#F4F7FF] text-gray-800 p-2 rounded-full shadow-lg hover:bg-gray-100 transition"><img src="/assets/svg/leftIcon.svg" alt=""></button>
|
||||
<button id="nextButton" class="flex justify-center items-center w-[40px] h-[40px] absolute right-4 top-1/2 transform -translate-y-1/2 bg-[#F4F7FF] text-gray-800 p-2 rounded-full shadow-lg hover:bg-gray-100 transition"><img src="/assets/svg/rightIcon.svg" alt=""></button>
|
||||
|
||||
<div id="slidetInfo" class="absolute bottom-0 left-0 right-0 bg-black bg-opacity-50 p-2 text-center text-white">
|
||||
<h2 class="text-lg font-bold" id="imageTitle">Image Title</h2>
|
||||
<p class="text-sm" id="imageDescription">Description goes here.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,34 +68,56 @@ import Layout from '../../layouts/Layout.astro';
|
|||
</Layout>
|
||||
<script src="/saveGameAI.js" is:inline></script>
|
||||
<script is:inline>
|
||||
const jsonData = [
|
||||
{
|
||||
"src": "/assets/back.jpeg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/background.jpg"
|
||||
},
|
||||
{
|
||||
"src": "/assets/backgroundImage.png"
|
||||
},
|
||||
{
|
||||
"src": "/assets/beanieImage.png"
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const akademyUserId = params.get('userId');
|
||||
const akademyGameName = params.get('gameName');
|
||||
const spriteNames = params.get('spriteName');
|
||||
let buddiesList = [ "arlo", "ava", "dax", "kai", "monstero", "yara" ]
|
||||
function displaySprite() {
|
||||
if (buddiesList.includes(spriteNames)) {
|
||||
const imgElement = document.getElementById('clipArtWithHand');
|
||||
document.getElementById('buddiesName').textContent = `Ask to ${spriteNames.charAt(0).toUpperCase() + spriteNames.slice(1)}`;
|
||||
if (imgElement) {
|
||||
imgElement.src = `/assets/hand-${spriteNames}.svg`;
|
||||
console.log(imgElement.src)
|
||||
} else {
|
||||
console.log('Element with ID "clipArtWithHand" not found.');
|
||||
}
|
||||
} else {
|
||||
console.log('Sprite not found in the list.');
|
||||
}
|
||||
}
|
||||
|
||||
displaySprite();
|
||||
|
||||
let galleryData = []; // Store gallery data from the API
|
||||
let currentSlide = 0; // Initialize the current slide index
|
||||
fetch(`http://localhost:5175/api/getGalleryImage?userId=${akademyUserId}&gameID=${paramsID}&gameName=${akademyGameName}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
galleryData = data; // Store the fetched gallery data
|
||||
updateSlide(); // Call updateSlide after the data is fetched
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
function updateSlide() {
|
||||
if (galleryData.length > 0) {
|
||||
document.getElementById('attemptCount').textContent = `Attempt ${currentSlide + 1}`;
|
||||
const slide = galleryData[currentSlide]; // Get the current slide's data
|
||||
document.getElementById('slideImage').src = slide.screenshotUrl; // Update the image source
|
||||
}
|
||||
];
|
||||
let currentSlide = 0;
|
||||
function updateSlide(){
|
||||
const slide = jsonData[currentSlide];
|
||||
document.getElementById('slideImage').src = slide.src;
|
||||
}
|
||||
document.getElementById('nextButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide + 1) % jsonData.length;
|
||||
console.log(currentSlide)
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide + 1) % galleryData.length; // Move to the next slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
document.getElementById('prevButton').addEventListener('click', () => {
|
||||
currentSlide = (currentSlide - 1 + jsonData.length) % jsonData.length;
|
||||
updateSlide();
|
||||
})
|
||||
currentSlide = (currentSlide - 1 + galleryData.length) % galleryData.length; // Move to the previous slide
|
||||
updateSlide(); // Update the slide
|
||||
});
|
||||
|
||||
updateSlide();
|
||||
let parentMainContainer = document.getElementById('parentMainContainer');
|
||||
let gallerySliderId = document.getElementById('gallerySliderId');
|
||||
|
@ -193,8 +219,6 @@ import Layout from '../../layouts/Layout.astro';
|
|||
// shortUniqueID = generateShortUniqueID(10); // Change 10 to the desired length
|
||||
// console.log(shortUniqueID);
|
||||
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramsID = params.get('id');
|
||||
const data = fetch(`https://game-du.teachertrainingkolkata.in/items/game_drawing_v3/${encodeURIComponent(paramsID)}?filter[status][_eq]=published`)
|
||||
.then(response => response.json())
|
||||
.then(({data}) => {
|
||||
|
@ -358,6 +382,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
submitButton.setInteractive().on('pointerdown', () => {
|
||||
submitUserData(this);
|
||||
showAnimation();
|
||||
document.getElementById('savedAudioMessage').play();
|
||||
parentMainContainer.classList.remove('hidden');
|
||||
if(isMobile){
|
||||
colorContainer.style.display = 'none';
|
||||
|
|
|
@ -19,7 +19,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
|
@ -95,7 +95,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -121,6 +124,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -140,6 +144,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let wrongCount = 0;
|
||||
|
@ -148,7 +154,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let url = window.location.href;
|
||||
let urlSplit = url.split('/');
|
||||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 6;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -282,19 +288,20 @@ import Layout from "../../layouts/Layout.astro";
|
|||
}
|
||||
});
|
||||
|
||||
// Move the userData object creation inside the saveUserData function if needed
|
||||
|
||||
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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
|
@ -350,51 +357,138 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
|
@ -119,7 +119,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -144,6 +147,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -163,6 +167,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let url = window.location.href;
|
||||
let urlSplit = url.split('/');
|
||||
|
@ -170,7 +176,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let totalPoints = 0;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 6;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -310,19 +316,20 @@ import Layout from "../../layouts/Layout.astro";
|
|||
totalPoints += 1;
|
||||
}
|
||||
});
|
||||
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, you’ve got this!` : '';
|
||||
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
|
@ -378,51 +385,138 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
|
|
@ -19,7 +19,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<div class="flex flex-col">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<!-- <p id="LearningSubArea"></p> -->
|
||||
|
@ -76,7 +76,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -101,6 +104,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -120,6 +124,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let starValue;
|
||||
|
@ -127,7 +133,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let urlSplit = url.split('/');
|
||||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let totalPoints = 0;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 3;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -236,17 +242,20 @@ import Layout from "../../layouts/Layout.astro";
|
|||
totalPoints += 1;
|
||||
}
|
||||
});
|
||||
totalPoints === 1 ? starValue = 5 : 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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -300,51 +309,140 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.fontWeight = '600';
|
||||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div class="flex flex-row space-x-1 pb-2">
|
||||
<button onclick="audioPlayAndPause()"><img src="/assets/svg/mute.svg" alt=""></button>
|
||||
<button onclick="retryGame()"><img src="/assets/svg/reset.svg" alt=""></button>
|
||||
<button onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button id="downloadBtn" onclick="saveUserData();"><img src="/assets/svg/tick2.svg" alt=""></button>
|
||||
<button onclick="history.back();"><img src="/assets/svg/cancel.svg" alt=""></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<form id="contactForm">
|
||||
<div id="itemForm" class="flex flex-row place-content-between gap-4">
|
||||
|
@ -92,7 +92,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -117,6 +120,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<!-- <script is:inline src="/html2canvas.min.js"></script> -->
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
|
||||
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -136,6 +143,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let totalPoints = 0;
|
||||
|
@ -144,7 +153,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 6;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -271,31 +280,29 @@ import Layout from "../../layouts/Layout.astro";
|
|||
element: element
|
||||
};
|
||||
});
|
||||
|
||||
// Count points based on checkbox values and "greenBorder" class
|
||||
checkboxValues.forEach(checkbox => {
|
||||
if (checkbox.checked && checkbox.element.classList.contains('greenBorder')) {
|
||||
totalPoints += 1;
|
||||
}
|
||||
});
|
||||
// Move the userData object creation inside the saveUserData function if needed
|
||||
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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);let progress = 0;
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
const blankStar = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
|
@ -343,52 +350,138 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
// https://api.teachertrainingkolkata.in/api/
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
document.getElementById('allParentDiv').style.display = 'block';
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
// console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const contactForm = document.getElementById('contactForm');
|
||||
|
@ -396,6 +489,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
// document.getElementById("downloadBtn").addEventListener("click", function() {});
|
||||
</script>
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Lobster&family=Quicksand:wght@500;700&display=swap');
|
||||
|
|
|
@ -19,11 +19,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<!-- <div class="flex flex-col">
|
||||
<p id="LearningArea"></p>
|
||||
<p id="LearningSubArea"></p>
|
||||
</div> -->
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<form id="contactForm" class="flex flex-col justify-center">
|
||||
<div id="" class="flex flex-row place-content-between gap-4">
|
||||
|
@ -119,7 +115,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -143,6 +142,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -162,13 +162,16 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let wrongCount = 0;
|
||||
let starValue;
|
||||
let url = window.location.href;
|
||||
let urlSplit = url.split('/');
|
||||
let gameData = null;
|
||||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 9;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -320,17 +323,21 @@ 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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
|
@ -385,51 +392,137 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
|
|
@ -20,7 +20,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<!-- <input onclick="saveUserData();" class="bg-blue-700 px-8 py-2 rounded-lg shadow-lg font-bold text-white cursor-pointer" type="submit" value="Submit"> -->
|
||||
</div>
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container mx-auto px-4" id="snapshotDiv">
|
||||
<div class="flex flex-col">
|
||||
<p class="sm:text-2xl md:text-3xl lg:text-4xl text-center font-[600] text-[#60C6CB] my-4 select-none" id="gameDescription"></p>
|
||||
<!-- <p id="LearningSubArea"></p> -->
|
||||
|
@ -78,7 +78,10 @@ import Layout from "../../layouts/Layout.astro";
|
|||
<div id="scoreBoard" class=" w-full h-screen bg-[#00000070] absolute" style="display: none;">
|
||||
<div class="flex absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 max-w-lg flex-col rounded-[8px] bg-white space-y-2 w-full p-6" >
|
||||
<div class="flex flex-row space-x-4 items-center justify-center">
|
||||
<div id="star-container"></div>
|
||||
<div id="star-container" class="relative inline-flex items-center justify-center">
|
||||
<img src="/assets/bg-star.svg" alt="" class="block" />
|
||||
<p id="get-star-value" class="absolute inset-0 flex items-center justify-center text-[#E76408] text-[40px] font-[900]"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row" style="margin-top: 15px; margin-bottom: 15px;">
|
||||
<img class="z-10" src="/assets/clip-art.svg" alt="" />
|
||||
|
@ -102,6 +105,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
|
||||
<script is:inline>
|
||||
let isPlaying = false;
|
||||
function audioPlayAndPause(){
|
||||
|
@ -121,6 +125,8 @@ import Layout from "../../layouts/Layout.astro";
|
|||
const gameId = params.get('id');
|
||||
const userId = params.get('userId');
|
||||
const gameName = params.get('gameName');
|
||||
const assignmentId = params.get('assignmentId');
|
||||
const worksheetId = params.get('worksheetId');
|
||||
let startTime = Date.now();
|
||||
let gameData = null;
|
||||
let starValue;
|
||||
|
@ -128,7 +134,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let urlSplit = url.split('/');
|
||||
// let gameName = urlSplit[3] + '-' + urlSplit[4].split('?')[0];
|
||||
let totalPoints = 0;
|
||||
let maxStarValue = 5;
|
||||
let maxScore = 3;
|
||||
let progress = 0;
|
||||
const progressBar = document.createElement('div');
|
||||
|
||||
|
@ -248,23 +254,25 @@ import Layout from "../../layouts/Layout.astro";
|
|||
totalPoints += 1;
|
||||
}
|
||||
});
|
||||
totalPoints === 1 ? starValue = 5 : 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, you’ve got this!` : '';
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
// console.log(userData);
|
||||
let starValue = Math.round((totalPoints / maxScore) * 10);
|
||||
starValue = starValue === 0 ? 3 : starValue;
|
||||
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.";
|
||||
}
|
||||
|
||||
progressIncrement();
|
||||
addStarScalingStyles();
|
||||
showClipArt();
|
||||
const blankStar = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#E3E3E3"/></svg>`
|
||||
|
||||
const starSVG = `<svg width="61" height="58" viewBox="0 0 61 58" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M60.0193 21.917C59.8274 21.3224 59.4648 20.7975 58.9767 20.4076C58.4885 20.0177 57.8964 19.7801 57.2741 19.7244L39.9564 18.1518L33.1086 2.12366C32.6035 0.949062 31.4537 0.188965 30.176 0.188965C28.8984 0.188965 27.7484 0.94918 27.2436 2.12659L20.3957 18.1519L3.07528 19.7244C2.45372 19.7813 1.86254 20.0194 1.37503 20.4092C0.887526 20.799 0.525135 21.3232 0.332789 21.917C-0.0622597 23.132 0.302554 24.4646 1.26527 25.3046L14.3555 36.7846L10.4954 53.7878C10.213 55.038 10.6982 56.3304 11.7355 57.0801C12.293 57.483 12.9454 57.6881 13.6032 57.6881C14.1704 57.6881 14.7329 57.5352 15.238 57.2331L30.176 48.305L45.1087 57.2331C46.2014 57.8905 47.5788 57.8304 48.6139 57.0801C49.1206 56.7134 49.5083 56.2057 49.7288 55.6204C49.9492 55.035 49.9928 54.3977 49.854 53.7878L45.9941 36.7846L59.0841 25.307C59.555 24.8957 59.8947 24.3552 60.0609 23.7525C60.2272 23.1498 60.2127 22.5115 60.0193 21.917Z" fill="#FECE00"/></svg>`;
|
||||
|
||||
const starContainer = document.getElementById('star-container');
|
||||
let scoreBoard = document.getElementById('scoreBoard');
|
||||
let loadingMainContainer = document.getElementById('loadingMainContainer');
|
||||
|
@ -312,51 +320,138 @@ import Layout from "../../layouts/Layout.astro";
|
|||
calculationText.style.color = 'rgba(0, 0, 0, 0.38)';
|
||||
containerDiv.appendChild(calculationText);
|
||||
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
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);
|
||||
}
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
|
||||
let snapImage = '';
|
||||
const div = document.getElementById("snapshotDiv");
|
||||
const images = div.getElementsByTagName('img');
|
||||
let loadedImagesCount = 0;
|
||||
for (let img of images) {
|
||||
if (img.complete) {
|
||||
loadedImagesCount++;
|
||||
} else {
|
||||
img.onload = () => {
|
||||
loadedImagesCount++;
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
if (loadedImagesCount === images.length) {
|
||||
takeSnapshot();
|
||||
}
|
||||
async function takeSnapshot() {
|
||||
try {
|
||||
const canvas = await html2canvas(div, {
|
||||
useCORS: true,
|
||||
allowTaint: true,
|
||||
});
|
||||
snapImage = canvas.toDataURL("image/jpeg");
|
||||
await saveScreenshot(snapImage);
|
||||
} catch (error) {
|
||||
console.error('Error in takeSnapshot:', error.message || error);
|
||||
}
|
||||
}
|
||||
async function saveScreenshot(snapImage) {
|
||||
const saveUserDataForScreenshot = {
|
||||
gameName: gameName,
|
||||
gameID: gameId,
|
||||
screenShot: snapImage,
|
||||
userId: userId,
|
||||
gameTime: timeDifferenceInSeconds
|
||||
};
|
||||
try {
|
||||
const saveResponse = await fetch('https://api.teachertrainingkolkata.in/api/saveGalleryImage', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(saveUserDataForScreenshot),
|
||||
});
|
||||
if (!saveResponse.ok) {
|
||||
const errorDetails = await saveResponse.text();
|
||||
console.error(`SaveGalleryImage failed: ${saveResponse.status} ${saveResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to save screenshot: ${saveResponse.statusText}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const saveResult = await saveResponse.json();
|
||||
if (saveResult.screenshotUrl) {
|
||||
let userData = {
|
||||
'gameName': gameName,
|
||||
'gameID': gameId,
|
||||
'userId': userId,
|
||||
'gameTime': timeDifferenceInSeconds,
|
||||
'score': totalPoints,
|
||||
'gameStar': starValue
|
||||
};
|
||||
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(userData)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
setTimeout(() => {
|
||||
if (response.ok) {
|
||||
if (response.status == 200) {
|
||||
loadingMainContainer.style.display = 'none';
|
||||
loadingDiv.style.display = 'none';
|
||||
starContainer.style.display = 'flex';
|
||||
starContainer.style.flexDirection = 'row';
|
||||
document.getElementById('starFeedbackMessage').innerHTML = feedbackMessage;
|
||||
document.getElementById('get-star-value').innerHTML = starValue;
|
||||
scoreBoard.style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
console.log('Something went wrong', response);
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
// console.log('Something Wrong', response);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error);
|
||||
});
|
||||
const userAnotherData = {
|
||||
assignmentId: assignmentId,
|
||||
worksheetId: worksheetId,
|
||||
studentId: userId,
|
||||
submissionFile: saveResult.screenshotUrl,
|
||||
};
|
||||
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
|
||||
try {
|
||||
const submitResponse = await fetch('https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': authToken,
|
||||
},
|
||||
body: JSON.stringify(userAnotherData),
|
||||
});
|
||||
if (!submitResponse.ok) {
|
||||
const errorDetails = await submitResponse.text();
|
||||
console.error(`SubmitWorksheet failed: ${submitResponse.status} ${submitResponse.statusText}`);
|
||||
console.error('Response Body:', errorDetails);
|
||||
throw new Error(`Failed to submit worksheet: ${submitResponse.statusText}`);
|
||||
}
|
||||
const submitResult = await submitResponse.json();
|
||||
// console.log('SubmitWorksheet API success:', submitResult);
|
||||
} catch (error) {
|
||||
console.error('Error in SubmitWorksheet API call:', error.message || error);
|
||||
}
|
||||
} else {
|
||||
console.error('SaveGalleryImage did not return a valid screenshotUrl:', saveResult);
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in saveScreenshot:', error.message || error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|