2023-06-17 19:11:29 +00:00
|
|
|
<script>
|
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
|
import { SyncLoader } from 'svelte-loading-spinners';
|
|
|
|
|
import PlayContainer from './Container.svelte';
|
|
|
|
|
import PlayHeader from './Header/index.svelte';
|
2023-08-02 19:35:27 +01:00
|
|
|
import { quizStore, playQuizStore } from '$lib/utils/store/org';
|
|
|
|
|
import { STEPS } from '$lib/utils/constants/quiz';
|
|
|
|
|
import { genQuizPin } from '$lib/utils/functions/org';
|
|
|
|
|
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
|
|
|
|
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
2023-06-17 19:11:29 +00:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let isGettingPin = $state(true);
|
2023-06-17 19:11:29 +00:00
|
|
|
|
|
|
|
|
function getPin() {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
$quizStore.pin = genQuizPin();
|
|
|
|
|
isGettingPin = false;
|
|
|
|
|
}, 3000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function goToPlayersStep() {
|
|
|
|
|
$playQuizStore.step = STEPS.WAIT_FOR_PLAYERS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
getPin();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<PlayContainer>
|
2025-11-01 15:49:29 +01:00
|
|
|
{#snippet header()}
|
|
|
|
|
<div>
|
|
|
|
|
<PlayHeader startCount={true} showCountDown={true} />
|
2023-06-17 19:11:29 +00:00
|
|
|
</div>
|
2025-11-01 15:49:29 +01:00
|
|
|
{/snippet}
|
2023-06-17 19:11:29 +00:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
{#snippet body()}
|
|
|
|
|
<div class="w-full rounded-md bg-white px-5 py-7 dark:bg-neutral-800">
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<p>1. Visit</p>
|
|
|
|
|
<h3>play.classroomio.com</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="">
|
|
|
|
|
<p>2. Enter Pin</p>
|
|
|
|
|
{#if isGettingPin}
|
|
|
|
|
<SyncLoader size="50" color="#1d4ed8" unit="px" duration="1s" />
|
|
|
|
|
{:else}
|
|
|
|
|
<h3>{$quizStore.pin}</h3>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/snippet}
|
|
|
|
|
|
|
|
|
|
{#snippet footer()}
|
|
|
|
|
<div class="flex items-center justify-center">
|
2025-11-21 12:18:04 +01:00
|
|
|
<p class="mr-3">Let's go</p>
|
2025-11-01 15:49:29 +01:00
|
|
|
<PrimaryButton label="View Players" variant={VARIANTS.OUTLINED} onClick={goToPlayersStep} />
|
|
|
|
|
</div>
|
|
|
|
|
{/snippet}
|
2023-06-17 19:11:29 +00:00
|
|
|
</PlayContainer>
|