🎨 Ran prettier

This commit is contained in:
Mawoka
2022-04-14 17:50:03 +02:00
parent 2b288b4626
commit 48e6dc97fa
2 changed files with 23 additions and 26 deletions
+1 -3
View File
@@ -7,9 +7,7 @@
}, },
body: JSON.stringify({ body: JSON.stringify({
q: '*', q: '*',
sort: [ sort: ['created_at:desc']
"created_at:desc"
]
}) })
}); });
return await response.json(); return await response.json();
+22 -23
View File
@@ -1,4 +1,4 @@
<script lang='ts' context='module'> <script lang="ts" context="module">
export async function load({ params, fetch, session }) { export async function load({ params, fetch, session }) {
const { quiz_id } = params; const { quiz_id } = params;
const res = await fetch(`/api/v1/quiz/get/public/${quiz_id}`); const res = await fetch(`/api/v1/quiz/get/public/${quiz_id}`);
@@ -22,7 +22,7 @@
} }
</script> </script>
<script lang='ts'> <script lang="ts">
import { getLocalization } from '$lib/i18n'; import { getLocalization } from '$lib/i18n';
import CollapsSection from '$lib/collapsible.svelte'; import CollapsSection from '$lib/collapsible.svelte';
import { createTippy } from 'svelte-tippy'; import { createTippy } from 'svelte-tippy';
@@ -81,15 +81,15 @@
</script> </script>
<div> <div>
<h1 class='text-4xl text-center'>{quiz.title}</h1> <h1 class="text-4xl text-center">{quiz.title}</h1>
<div class='text-center'> <div class="text-center">
<p>{quiz.description}</p> <p>{quiz.description}</p>
</div> </div>
<div class='flex justify-center m-8'> <div class="flex justify-center m-8">
{#if logged_in} {#if logged_in}
<button <button
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' 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"
on:click={() => { on:click={() => {
startGame(quiz.id); startGame(quiz.id);
}} }}
@@ -98,46 +98,45 @@
</button> </button>
{:else} {:else}
<button <button
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 cursor-not-allowed opacity-50' 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 cursor-not-allowed opacity-50"
use:tippy={{ content: 'You need to be logged in to start a game' }} use:tippy={{ content: 'You need to be logged in to start a game' }}
> >
{$t('words.start')} {$t('words.start')}
</button> </button>
{/if} {/if}
</div> </div>
<div class='flex justify-center'> <div class="flex justify-center">
<a href='mailto:report@mawoka.eu?subject=Report quiz {quiz.id}' class='text-sm underline'> <a href="mailto:report@mawoka.eu?subject=Report quiz {quiz.id}" class="text-sm underline">
{$t('words.report')} {$t('words.report')}
</a> </a>
</div> </div>
{#each quiz.questions as question, index_question} {#each quiz.questions as question, index_question}
<div class='px-4 py-1'> <div class="px-4 py-1">
<CollapsSection headerText={question.question}> <CollapsSection headerText={question.question}>
<div class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2'> <div class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2">
<h1 class='text-3xl m-1'>{$t('words.question')} {index_question + 1}</h1> <h1 class="text-3xl m-1">{$t('words.question')} {index_question + 1}</h1>
<!-- <label class='m-1 flex flex-row gap-2 w-3/5'>--> <!-- <label class='m-1 flex flex-row gap-2 w-3/5'>-->
<p class='text-black w-full bg-inherit'> <p class="text-black w-full bg-inherit">
{$t('words.question')}: {question.question} {$t('words.question')}: {question.question}
</p> </p>
<!-- </label>--> <!-- </label>-->
{#if question.image} {#if question.image}
<span> <span>
{$t('words.image')}: {$t('words.image')}:
<img class='pl-8' src={question.image} alt='Not provided' /> <img class="pl-8" src={question.image} alt="Not provided" />
</span> </span>
{/if} {/if}
<span class='m-1 flex flex-row gap-2 w-3/5 flex-nowrap whitespace-nowrap'> <span class="m-1 flex flex-row gap-2 w-3/5 flex-nowrap whitespace-nowrap">
{$t('editor.time_in_seconds')}: {$t('editor.time_in_seconds')}:
<p>{question.time}</p> <p>{question.time}</p>
</span> </span>
{#each question.answers as answer, index_answer} {#each question.answers as answer, index_answer}
<div <div
class='ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2 m-1' class="ml-8 grid grid-cols-1 gap-2 m-2 border border-black border-2 m-1"
> >
<h1 class='text-3xl m-1'>{$t('words.answer')} {index_answer + 1}</h1> <h1 class="text-3xl m-1">{$t('words.answer')} {index_answer + 1}</h1>
<p class='m-1'> <p class="m-1">
{$t('words.answer')}: {index_answer + 1} {$t('words.answer')}: {index_answer + 1}
{$t('words.question')}: {index_question + 1} {$t('words.question')}: {index_question + 1}
</p> </p>
@@ -146,15 +145,15 @@
: {quiz.questions[index_question].answers[index_answer].answer} : {quiz.questions[index_question].answers[index_answer].answer}
</p> </p>
<label <label
class='m-1 flex flex-row gap-2 w-2/6 flex-nowrap whitespace-nowrap' class="m-1 flex flex-row gap-2 w-2/6 flex-nowrap whitespace-nowrap"
> >
<input <input
type='checkbox' type="checkbox"
bind:checked={answer.right} bind:checked={answer.right}
class='text-black w-fit' class="text-black w-fit"
disabled disabled
/> />
<span class='w-fit'>{$t('editor.right_or_true?')}</span> <span class="w-fit">{$t('editor.right_or_true?')}</span>
</label> </label>
</div> </div>
{/each} {/each}