🎨 Ran prettier

This commit is contained in:
Mawoka
2022-03-06 11:26:08 +01:00
parent 8a6f64dbc8
commit b8c0ba0179
16 changed files with 3626 additions and 2773 deletions
+3181 -2333
View File
File diff suppressed because it is too large Load Diff
+6 -8
View File
@@ -2,20 +2,18 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@fontsource/marck-script;
@fontsource /marck-script;
.marck-script {
font-family: 'Marck Script';
font-family: 'Marck Script';
}
.link-hover {
transition: all 0.3s;
transition: all 0.3s;
}
.link-hover:hover {
background: linear-gradient(90deg, #009444, #39b54a, #8dc63f);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background: linear-gradient(90deg, #009444, #39b54a, #8dc63f);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
+46 -28
View File
@@ -1,4 +1,4 @@
<script lang='ts'>
<script lang="ts">
interface Data {
public: boolean;
title: string;
@@ -18,15 +18,17 @@
}
export let data: Data;
export let submit_button_text = "Create";
export let submit_button_text = 'Create';
const empty_question: Question = {
question: '',
time: '20',
answers: [{
right: false,
answer: ''
}]
answers: [
{
right: false,
answer: ''
}
]
};
const empty_answer: Answer = {
@@ -35,57 +37,73 @@
};
</script>
<label>
<input type='checkbox' bind:checked={data.public}>
<input type="checkbox" bind:checked={data.public} />
Public?
</label>
<label>
<input type='text' placeholder='Title' bind:value={data.title} class='text-black' />
<input type="text" placeholder="Title" bind:value={data.title} class="text-black" />
Title
</label>
<label>
<textarea placeholder='Description' bind:value={data.description} class='text-black'></textarea>
<textarea placeholder="Description" bind:value={data.description} class="text-black" />
Description
</label>
{#each data.questions as question, index_question}
<div class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2'>
<h1 class='text-3xl'>Question {index_question + 1}</h1>
<div class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2">
<h1 class="text-3xl">Question {index_question + 1}</h1>
<label>
<input type='text' placeholder='Question' bind:value={question.question} class='text-black' />
<input
type="text"
placeholder="Question"
bind:value={question.question}
class="text-black"
/>
Question
</label>
<label>
<input type='text' placeholder='20' bind:value={question.time} class='text-black' />
<input type="text" placeholder="20" bind:value={question.time} class="text-black" />
Time in seconds
</label>
{#each question.answers as answer, index_answer}
<div class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2'>
<h1 class='text-3xl'>Answer {index_answer + 1}</h1>
<div class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2">
<h1 class="text-3xl">Answer {index_answer + 1}</h1>
<p>Answer: {index_answer} Question: {index_question}</p>
<label>
<input type='text' placeholder='Answer'
bind:value={data.questions[index_question].answers[index_answer].answer}
class='text-black' />
<input
type="text"
placeholder="Answer"
bind:value={data.questions[index_question].answers[index_answer].answer}
class="text-black"
/>
Answer
</label>
<label>
<input type='checkbox' bind:checked={answer.right} class='text-black' />
<input type="checkbox" bind:checked={answer.right} class="text-black" />
Right?
</label>
<button class='text-left'
on:click={() => {data.questions[index_question].answers = [...data.questions[index_question].answers, {...empty_answer}]}}>
<button
class="text-left"
on:click={() => {
data.questions[index_question].answers = [
...data.questions[index_question].answers,
{ ...empty_answer }
];
}}
>
Add new answer
</button>
</div>
{/each}
<button class='text-left' on:click={() => {data.questions = [...data.questions, {...empty_question}]}}>
Add new
question
<button
class="text-left"
on:click={() => {
data.questions = [...data.questions, { ...empty_question }];
}}
>
Add new question
</button>
</div>
{/each}
<button type='submit'>{submit_button_text}</button>
<button type="submit">{submit_button_text}</button>
+47 -48
View File
@@ -12,85 +12,84 @@
</script>
<nav
class='w-screen px-4 lg:px-10 py-2 flex flex-col lg:flex-row lg:items-center fixed backdrop-blur-sm bg-white/60 shadow-md z-50 top-0'
class="w-screen px-4 lg:px-10 py-2 flex flex-col lg:flex-row lg:items-center fixed backdrop-blur-sm bg-white/60 shadow-md z-50 top-0"
>
<!-- Our logo and button -->
<section class='w-full lg:w-max flex justify-between'>
<section class="w-full lg:w-max flex justify-between">
<!-- Logo -->
<a href='/' class='font-black tracking-tight text-xl text-black marck-script link-hover'
>ClassQuiz</a
<a href="/" class="font-black tracking-tight text-xl text-black marck-script link-hover"
>ClassQuiz</a
>
<!-- Our open/close buttons -->
<!-- Open menu -->
<button class='lg:hidden' id='open-menu' on:click={toggleMenu} class:hidden={!openMenu}>
<button class="lg:hidden" id="open-menu" on:click={toggleMenu} class:hidden={!openMenu}>
<svg
xmlns='http://www.w3.org/2000/svg'
width='24'
height='24'
viewBox='0 0 24 24'
fill='none'
stroke='currentColor'
stroke-width='2'
stroke-linecap='round'
stroke-linejoin='round'
display='block'
id='TextAlignJustified'
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
display="block"
id="TextAlignJustified"
>
<path d='M3 6h18M3 12h18M3 18h18' />
<path d="M3 6h18M3 12h18M3 18h18" />
</svg>
</button>
<!-- Close menu -->
<button class='hidden' id='close-menu' class:hidden={!closeMenu} on:click={toggleMenu}>
<button class="hidden" id="close-menu" class:hidden={!closeMenu} on:click={toggleMenu}>
<svg
xmlns='http://www.w3.org/2000/svg'
width='14'
height='14'
viewBox='0 0 24 24'
fill='none'
stroke='currentColor'
stroke-width='3'
stroke-linecap='round'
stroke-linejoin='round'
display='block'
id='Cross'
xmlns="http://www.w3.org/2000/svg"
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="3"
stroke-linecap="round"
stroke-linejoin="round"
display="block"
id="Cross"
>
<path d='M20 20L4 4m16 0L4 20' />
<path d="M20 20L4 4m16 0L4 20" />
</svg>
</button>
</section>
<!-- Our list of items -->
<ul
id='menu-items'
class='lg:flex w-full flex-col lg:flex-row lg:pl-6'
id="menu-items"
class="lg:flex w-full flex-col lg:flex-row lg:pl-6"
class:hidden={!menuItems}
>
<li class='py-2'>
<li class="py-2">
<a
class='text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover'
href='/play'>Play</a
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
href="/play">Play</a
>
</li>
<li class='py-2'>
<li class="py-2">
<a
class='text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover'
href='/account/register'>Register</a
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
href="/account/register">Register</a
>
</li>
<li class='py-2'>
<li class="py-2">
<a
class='text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover'
href='/account/login'>Login</a
>
<li class='py-2'>
<a
class='text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover'
href='https://github.com/mawoka-myblock/classquiz'>GitHub</a
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
href="/account/login">Login</a
>
</li>
<li class="py-2">
<a
class="text-lg font-medium lg:px-4 text-gray-600 hover:text-green-600 link-hover"
href="https://github.com/mawoka-myblock/classquiz">GitHub</a
>
</li>
</ul>
</nav>
+21 -23
View File
@@ -1,4 +1,4 @@
<script lang='ts'>
<script lang="ts">
import { socket } from '$lib/socket';
import { onDestroy, onMount } from 'svelte';
import { browser } from '$app/env';
@@ -11,8 +11,7 @@
let hcaptcha = {
execute: async (_a, _b) => ({ response: '' }),
render: (_a, _b) => {
}
render: (_a, _b) => {}
};
let hcaptchaWidgetID;
@@ -33,8 +32,7 @@
if (browser) {
hcaptcha = {
execute: async () => ({ response: '' }),
render: () => {
}
render: () => {}
};
}
});
@@ -59,27 +57,27 @@
</script>
<svelte:head>
<script src='https://js.hcaptcha.com/1/api.js?render=explicit' async defer></script>
<script src="https://js.hcaptcha.com/1/api.js?render=explicit" async defer></script>
</svelte:head>
{#if game_pin === '' || game_pin.length <= 7}
<div class='flex flex-col justify-center align-center w-screen h-screen'>
<div class="flex flex-col justify-center align-center w-screen h-screen">
<form
on:submit|preventDefault={() => {}}
class='flex-col flex justify-center align-center mx-auto'
class="flex-col flex justify-center align-center mx-auto"
>
<h1 class='text-lg text-center'>Game Pin</h1>
<h1 class="text-lg text-center">Game Pin</h1>
<input
class='border border-amber-800 self-center text-center text-black'
class="border border-amber-800 self-center text-center text-black"
bind:value={game_pin}
maxlength='8'
maxlength="8"
/>
<!-- use:tippy={{content: "Please enter the game pin", sticky: true, placement: 'top'}}-->
<br />
<button
class='bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded disabled:opacity-50 disabled:cursor-not-allowed mt-2'
type='submit'
class="bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded disabled:opacity-50 disabled:cursor-not-allowed mt-2"
type="submit"
disabled={game_pin.length <= 7}
>
Submit
@@ -87,16 +85,16 @@
</form>
</div>
{:else}
<div class='flex flex-col justify-center align-center w-screen h-screen'>
<div class="flex flex-col justify-center align-center w-screen h-screen">
<form
on:submit|preventDefault={setUsername}
class='flex-col flex justify-center align-center mx-auto'
class="flex-col flex justify-center align-center mx-auto"
>
<h1 class='text-lg text-center'>Username</h1>
<input class='border border-amber-800 text-black text-center' bind:value={username} />
<h1 class="text-lg text-center">Username</h1>
<input class="border border-amber-800 text-black text-center" bind:value={username} />
<button
class='bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded disabled:cursor-not-allowed disabled:opacity-50 mt-2'
type='submit'
class="bg-amber-800 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded disabled:cursor-not-allowed disabled:opacity-50 mt-2"
type="submit"
disabled={username.length <= 3}
>
Submit
@@ -105,9 +103,9 @@
</div>
{/if}
<div
id='hcaptcha'
class='h-captcha'
id="hcaptcha"
class="h-captcha"
data-sitekey={hcaptchaSitekey}
data-size='invisible'
data-theme='dark'
data-size="invisible"
data-theme="dark"
/>
+1 -2
View File
@@ -1,4 +1,3 @@
import { writable } from 'svelte/store';
export const navbarVisible = writable(true);
export const navbarVisible = writable(true);
+27 -27
View File
@@ -6,36 +6,36 @@
{#if $navbarVisible}
<Navbar />
<div class='pt-16 h-screen'>
<div class="pt-16 h-screen">
<slot />
</div>
{:else}
<slot></slot>
<slot />
{/if}
<style lang='scss'>
:global(body) {
background: linear-gradient(to right, #009444, #39b54a, #8dc63f);
// height: 100%;
// width: 100%;
background-repeat: no-repeat;
background-size: cover;
/*background: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%); */
/*background: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%); */
color: beige;
background-size: 400% 400%;
animation: background_animation 30s ease infinite;
}
<style lang="scss">
:global(body) {
background: linear-gradient(to right, #009444, #39b54a, #8dc63f);
// height: 100%;
// width: 100%;
background-repeat: no-repeat;
background-size: cover;
/*background: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%); */
/*background: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%); */
color: beige;
background-size: 400% 400%;
animation: background_animation 30s ease infinite;
}
@keyframes background_animation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
</style>
@keyframes background_animation {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
</style>
+81 -86
View File
@@ -1,4 +1,4 @@
<script context='module' lang='ts'>
<script context="module" lang="ts">
export async function load({ session }) {
if (session.authenticated) {
return {
@@ -10,13 +10,12 @@
}
</script>
<script lang='ts'>
<script lang="ts">
import { navbarVisible } from '$lib/stores';
import { browser } from '$app/env';
navbarVisible.set(true);
let loginData = {
email: '',
password: ''
@@ -34,7 +33,6 @@
$: passwordEmpty = loginData.password === '';
$: inputValid = !emailEmpty && !passwordEmpty;
const checkRememberMe = async () => {
const res = await fetch('/api/v1/users/token/rememberme');
if (res.status === 200) {
@@ -43,7 +41,6 @@
};
if (browser) {
checkRememberMe();
}
const login = async (): Promise<void> => {
@@ -70,80 +67,78 @@
};
</script>
<div class='flex items-center justify-center h-full px-4'>
<div class="flex items-center justify-center h-full px-4">
<div>
<span class='p-4' />
<span class="p-4" />
<div
class='w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800'
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800"
>
<div class='px-6 py-4'>
<h2 class='text-3xl font-bold text-center text-gray-700 dark:text-white'>
<div class="px-6 py-4">
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">
ClassQuiz
</h2>
<h3 class='mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200'>
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200">
Welcome Back
</h3>
<p class='mt-1 text-center text-gray-500 dark:text-gray-400'>
<p class="mt-1 text-center text-gray-500 dark:text-gray-400">
Login or create account
</p>
<form on:submit|preventDefault={login}>
<div class='w-full mt-4'>
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class='relative bg-inherit w-full'>
<div class="w-full mt-4">
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
<div class="relative bg-inherit w-full">
<input
id='email'
id="email"
bind:value={loginData.email}
name='email'
type='email'
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder='Email'
name="email"
type="email"
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
placeholder="Email"
/>
<label
for='email'
class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
for="email"
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
>
Email
</label>
</div>
</div>
<div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class='relative bg-inherit w-full'>
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg">
<div class="relative bg-inherit w-full">
<input
id='password'
name='password'
type='password'
id="password"
name="password"
type="password"
bind:value={loginData.password}
class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder='Password'
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600"
placeholder="Password"
/>
<label
for='password'
class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
for="password"
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all"
>
Password
</label>
</div>
</div>
<div class='flex items-center justify-between mt-4'>
<div class="flex items-center justify-between mt-4">
<a
href='/account/reset-password'
class='text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500'
>Forgot Password?</a
href="/account/reset-password"
class="text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500"
>Forgot Password?</a
>
<button
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
disabled={!inputValid}
type='submit'
type="submit"
>
{#if isSubmitting}
{:else}
{#if isSubmitting}{:else}
Login
{/if}
</button>
@@ -153,16 +148,16 @@
</div>
<div
class='flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700'
class="flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700"
>
<span class='text-sm text-gray-600 dark:text-gray-200'
>Don't have an account?
<span class="text-sm text-gray-600 dark:text-gray-200"
>Don't have an account?
</span>
<a
href='/account/register'
class='mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline'
>Register</a
href="/account/register"
class="mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline"
>Register</a
>
</div>
</div>
@@ -170,14 +165,14 @@
</div>
<div
class='fixed z-10 inset-0 overflow-y-auto'
aria-labelledby='modal-title'
role='dialog'
aria-modal='true'
class="fixed z-10 inset-0 overflow-y-auto"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
class:hidden={!responseData.open}
>
<div
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
>
<!--
Background overlay, show/hide based on modal state.
@@ -190,13 +185,13 @@
To: "opacity-0"
-->
<div
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
aria-hidden='true'
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
aria-hidden="true"
/>
<!-- This element is to trick the browser into centering the modal contents. -->
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
>&#8203;</span
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
>&#8203;</span
>
<!--
@@ -210,49 +205,49 @@
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
-->
<div
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
>
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
<div class='sm:flex sm:items-start'>
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
>
<!-- Heroicon name: outline/exclamation -->
{#if responseData.data === '404' || responseData.data === 'error'}
<svg
class='h-6 w-6 text-red-600'
xmlns='http://www.w3.org/2000/svg'
fill='none'
viewBox='0 0 24 24'
stroke='currentColor'
aria-hidden='true'
class="h-6 w-6 text-red-600"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
>
<path
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
{:else}
<svg
class='w-6 h-6 text-green-600'
fill='none'
stroke='currentColor'
viewBox='0 0 24 24'
xmlns='http://www.w3.org/2000/svg'
class="w-6 h-6 text-green-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
{/if}
</div>
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
{#if responseData.data === 'magic'}
Login Succeded! Check your mailbox!
{:else if responseData.data === 'password'}
@@ -265,8 +260,8 @@
You stupid Mawoka!
{/if}
</h3>
<div class='mt-2'>
<p class='text-sm text-gray-500'>
<div class="mt-2">
<p class="text-sm text-gray-500">
{#if responseData.data === 'magic'}
Please check your mailbox, since you should have received a
Mail, with a link you can click to login.
@@ -284,17 +279,17 @@
</div>
</div>
</div>
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button
type='button'
type="button"
on:click={() => {
responseData.open = false;
if (responseData.data === 'magic' || responseData.data === 'password') {
window.location.reload();
}
}}
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
>Close
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
>Close
</button>
</div>
</div>
+5 -3
View File
@@ -14,8 +14,8 @@
import { createForm } from 'felte';
// import reporter from '@felte/reporter-tippy';
import { validateSchema } from '@felte/validator-yup';
import {navbarVisible} from '$lib/stores';
navbarVisible.set(true)
import { navbarVisible } from '$lib/stores';
navbarVisible.set(true);
import * as yup from 'yup';
const registerSchema = yup.object({
@@ -75,7 +75,9 @@
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800"
>
<div class="px-6 py-4">
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">ClassQuiz</h2>
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white">
ClassQuiz
</h2>
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200">
Nice to meet you!
+14 -12
View File
@@ -1,4 +1,4 @@
<script context='module' lang='ts'>
<script context="module" lang="ts">
export async function load({ session, url }) {
if (!session.authenticated) {
return {
@@ -22,8 +22,7 @@
}
</script>
<script lang='ts'>
<script lang="ts">
import type { QuizData } from '../app';
import { socket } from '$lib/socket';
@@ -106,18 +105,21 @@
</script>
{#if !success}
<input placeholder='game id' bind:value={game_token} />
<input placeholder='game pin' bind:value={game_pin} />
<input placeholder="game id" bind:value={game_token} />
<input placeholder="game pin" bind:value={game_pin} />
<button on:click={connect}>Connect!</button>
{#if errorMessage !== ''}
<p class='text-red-700'>{errorMessage}</p>
<p class="text-red-700">{errorMessage}</p>
{/if}
{:else if !game_started}
<img alt='QR code to join the game' src='/api/v1/utils/qr/{quiz_data.game_pin}' class='block mx-auto w-1/6' />
<p class='text-3xl text-center'>Pin: {quiz_data.game_pin}</p>
<img
alt="QR code to join the game"
src="/api/v1/utils/qr/{quiz_data.game_pin}"
class="block mx-auto w-1/6"
/>
<p class="text-3xl text-center">Pin: {quiz_data.game_pin}</p>
<ul>
{#if players.length > 0}
{#each players as player}
<li>
<span>{player.username} </span>
@@ -131,9 +133,9 @@
on:click={() => {
socket.emit('start_game', '');
game_started = true;
}}>Start Game
</button
>
}}
>Start Game
</button>
{/if}
{:else}
<span>Time left: {timer_res}</span>
+35 -38
View File
@@ -1,4 +1,4 @@
<script context='module' lang='ts'>
<script context="module" lang="ts">
export async function load({ session, url }) {
if (!session.authenticated) {
return {
@@ -22,7 +22,7 @@
}
</script>
<script lang='ts'>
<script lang="ts">
import { onMount } from 'svelte';
import Editor from '$lib/editor.svelte';
@@ -63,7 +63,6 @@
}
});
const submit = async () => {
const res = await fetch('/api/v1/quiz/create', {
method: 'POST',
@@ -79,76 +78,74 @@
responseData.open = true;
}
};
</script>
{#if data !== undefined}
<form on:submit|preventDefault={submit} class='grid grid-cols-1 gap-2'>
<form on:submit|preventDefault={submit} class="grid grid-cols-1 gap-2">
<Editor bind:data />
</form>
{/if}
<div
class='fixed z-10 inset-0 overflow-y-auto'
aria-labelledby='modal-title'
role='dialog'
aria-modal='true'
class="fixed z-10 inset-0 overflow-y-auto"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
class:hidden={!responseData.open}
>
<div
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
>
<div
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
aria-hidden='true'
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
aria-hidden="true"
/>
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
>&#8203;</span
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
>&#8203;</span
>
<div
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
>
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
<div class='sm:flex sm:items-start'>
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
>
<!-- Heroicon name: outline/exclamation -->
<svg
class='w-6 h-6 text-green-600'
fill='none'
stroke='currentColor'
viewBox='0 0 24 24'
xmlns='http://www.w3.org/2000/svg'
class="w-6 h-6 text-green-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Successfully created quiz!
</h3>
<div class='mt-2'>
<p class='text-sm text-gray-500'>
Created the quiz successfully!
</p>
<div class="mt-2">
<p class="text-sm text-gray-500">Created the quiz successfully!</p>
</div>
</div>
</div>
</div>
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button
type='button'
type="button"
on:click={() => {
window.location.href = "/overview"
window.location.href = '/overview';
}}
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
>Close
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
>Close
</button>
</div>
</div>
+43 -47
View File
@@ -1,4 +1,4 @@
<script lang='ts' context='module'>
<script lang="ts" context="module">
export async function load({ url }) {
const quiz_id = url.searchParams.get('quiz_id');
if (quiz_id === null) {
@@ -13,7 +13,8 @@
};
}
</script>
<script lang='ts'>
<script lang="ts">
import Editor from '$lib/editor.svelte';
let responseData = {
@@ -68,96 +69,91 @@
responseData.open = true;
}
};
</script>
{#await get_quiz()}
<svg class='h-8 w-8 animate-spin mx-auto my-20' viewBox='3 3 18 18'>
<svg class="h-8 w-8 animate-spin mx-auto my-20" viewBox="3 3 18 18">
<path
class='fill-black'
d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
class="fill-black"
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
/>
<path
class='fill-blue-100'
d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
class="fill-blue-100"
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
/>
</svg>
{:then lol}
{#if data !== undefined}
<form on:submit|preventDefault={submit} class='grid grid-cols-1 gap-2'>
<Editor bind:data submit_button_text={"Save"} />
<form on:submit|preventDefault={submit} class="grid grid-cols-1 gap-2">
<Editor bind:data submit_button_text={'Save'} />
</form>
{/if}
{:catch err}
<div class='text-center'>
<h1 class='text-5xl font-bold'>{err.message}</h1>
<div class="text-center">
<h1 class="text-5xl font-bold">{err.message}</h1>
</div>
{/await}
<div
class='fixed z-10 inset-0 overflow-y-auto'
aria-labelledby='modal-title'
role='dialog'
aria-modal='true'
class="fixed z-10 inset-0 overflow-y-auto"
aria-labelledby="modal-title"
role="dialog"
aria-modal="true"
class:hidden={!responseData.open}
>
<div
class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
>
<div
class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
aria-hidden='true'
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
aria-hidden="true"
/>
<span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
>&#8203;</span
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true"
>&#8203;</span
>
<div
class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
>
<div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
<div class='sm:flex sm:items-start'>
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div
class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"
>
<!-- Heroicon name: outline/exclamation -->
<svg
class='w-6 h-6 text-green-600'
fill='none'
stroke='currentColor'
viewBox='0 0 24 24'
xmlns='http://www.w3.org/2000/svg'
class="w-6 h-6 text-green-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap='round'
stroke-linejoin='round'
stroke-width='2'
d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
<div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
<h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Successfully updated quiz!
</h3>
<div class='mt-2'>
<p class='text-sm text-gray-500'>
Updated the quiz successfully!
</p>
<div class="mt-2">
<p class="text-sm text-gray-500">Updated the quiz successfully!</p>
</div>
</div>
</div>
</div>
<div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button
type='button'
type="button"
on:click={() => {
window.location.href = "/overview"
window.location.href = '/overview';
}}
class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
>Close
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
>Close
</button>
</div>
</div>
+9 -9
View File
@@ -1,20 +1,20 @@
<script lang="ts">
import {navbarVisible} from '$lib/stores';
import { navbarVisible } from '$lib/stores';
navbarVisible.set(true);
</script>
<section>
<div class='pt-12 text-center'>
<h1 class='sm:text-8xl text-6xl mt-6 marck-script'>ClassQuiz</h1>
<p class='text-xl mt-4'>The open-source quiz-platform!</p>
<div class="pt-12 text-center">
<h1 class="sm:text-8xl text-6xl mt-6 marck-script">ClassQuiz</h1>
<p class="text-xl mt-4">The open-source quiz-platform!</p>
</div>
</section>
<section id='features'>
<div class='text-center pt-48 snap-y'>
<h1 class='sm:text-6xl text-4xl'>Features</h1>
<p class='text-xl pt-4'>
<section id="features">
<div class="text-center pt-48 snap-y">
<h1 class="sm:text-6xl text-4xl">Features</h1>
<p class="text-xl pt-4">
ClassQuiz is a quiz-platform that allows you to create and manage quizzes.
<br>
<br />
Other than that, there are no features.
</p>
</div>
+107 -105
View File
@@ -1,4 +1,4 @@
<script context='module' lang='ts'>
<script context="module" lang="ts">
export async function load({ session }) {
if (!session.authenticated) {
return {
@@ -13,11 +13,11 @@
};
}
</script>
<script lang='ts'>
<script lang="ts">
import type { QuizData } from '../app';
import { DateTime } from 'luxon';
const getData = async (): Promise<Array<QuizData>> => {
const res = await fetch('/api/v1/quiz/list');
return await res.json();
@@ -42,126 +42,128 @@
const data = await res.json();
window.location.replace(`/admin?token=${data.game_id}&pin=${data.game_pin}&connect=1`);
};
</script>
{#await getData()}
<svg class='h-8 w-8 animate-spin mx-auto my-20' viewBox='3 3 18 18'>
<svg class="h-8 w-8 animate-spin mx-auto my-20" viewBox="3 3 18 18">
<path
class='fill-black'
d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
class="fill-black"
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z"
/>
<path
class='fill-blue-100'
d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
class="fill-blue-100"
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z"
/>
</svg>
{:then quizzes}
<div class='flex flex-col w-fit mx-auto'>
<div class="flex flex-col w-fit mx-auto">
<!-- <button
class='px-4 py-2 font-medium tracking-wide text-gray-500 whitespace-nowrap dark:text-gray-400 capitalize transition-colors dark:bg-gray-700 duration-200 transform bg-gray-50 rounded-md hover:bg-green-600 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80'>
Primary
</button>-->
<div class='w-full grid grid-cols-2 gap-2'>
<a href='/create'
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
>Create
<div class="w-full grid grid-cols-2 gap-2">
<a
href="/create"
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
>Create
</a>
<a href='/api/v1/users/logout'
class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
>Logout
<a
href="/api/v1/users/logout"
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50"
>Logout
</a>
</div>
<div class='overflow-x-auto sm:-mx-8 lg:-mx-8'>
<div class='inline-block py-2 min-w-full sm:px-6 lg:px-8'>
<div class='overflow-hidden shadow-md sm:rounded-lg'>
<table class='min-w-full'>
<thead class='bg-gray-50 dark:bg-gray-700'>
<tr>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Title
</th>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Created at
</th>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Question count
</th>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Play
</th>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Edit
</th>
<th
scope='col'
class='py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400'
>
Public
</th>
</tr>
<div class="overflow-x-auto sm:-mx-8 lg:-mx-8">
<div class="inline-block py-2 min-w-full sm:px-6 lg:px-8">
<div class="overflow-hidden shadow-md sm:rounded-lg">
<table class="min-w-full">
<thead class="bg-gray-50 dark:bg-gray-700">
<tr>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Title
</th>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Created at
</th>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Question count
</th>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Play
</th>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Edit
</th>
<th
scope="col"
class="py-3 px-6 text-xs font-medium tracking-wider text-left text-gray-700 uppercase dark:text-gray-400"
>
Public
</th>
</tr>
</thead>
<tbody>
<!-- Product 1 -->
{#each quizzes as quiz}
<tr class='bg-white border-b dark:bg-gray-800 dark:border-gray-700'>
<td
class='py-4 px-6 text-sm font-medium text-gray-900 whitespace-nowrap dark:text-white'
>
{quiz.title}
</td>
<td
class='py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400'
>
{formatDate(quiz.created_at)}
</td>
<td
class='py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400'
>
{quiz.questions.length}
</td>
<td
class='py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400'
>
<button on:click={() => {startGame(quiz.id)}} class='border border-green-600'>
Start
</button>
</td>
<td
class='py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400'
>
<a href='/edit?quiz_id={quiz.id}'>Edit</a>
</td>
<td
class='py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400'
>
{#if quiz.public}
{:else}
{/if}
</td>
</tr>
{/each}
<!-- Product 1 -->
{#each quizzes as quiz}
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
<td
class="py-4 px-6 text-sm font-medium text-gray-900 whitespace-nowrap dark:text-white"
>
{quiz.title}
</td>
<td
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
>
{formatDate(quiz.created_at)}
</td>
<td
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
>
{quiz.questions.length}
</td>
<td
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
>
<button
on:click={() => {
startGame(quiz.id);
}}
class="border border-green-600"
>
Start
</button>
</td>
<td
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
>
<a href="/edit?quiz_id={quiz.id}">Edit</a>
</td>
<td
class="py-4 px-6 text-sm text-gray-500 whitespace-nowrap dark:text-gray-400"
>
{#if quiz.public}
{:else}
{/if}
</td>
</tr>
{/each}
</tbody>
</table>
</div>
+2 -3
View File
@@ -1,4 +1,4 @@
<script context='module' lang='ts'>
<script context="module" lang="ts">
export async function load({ url }) {
const token = url.searchParams.get('pin');
return {
@@ -9,7 +9,7 @@
}
</script>
<script lang='ts'>
<script lang="ts">
import { socket } from '$lib/socket';
import JoinGame from '$lib/play/join.svelte';
import type { Answer, QuizData } from '../app';
@@ -67,7 +67,6 @@
answer_results = JSON.parse(data);
});
// The rest
</script>
<div>
+1 -1
View File
@@ -35,5 +35,5 @@
// "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
//}
{
"extends": "./.svelte-kit/tsconfig.json"
"extends": "./.svelte-kit/tsconfig.json"
}