Formatted code
This commit is contained in:
@@ -4,7 +4,7 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
|||||||
SPDX-License-Identifier: MPL-2.0
|
SPDX-License-Identifier: MPL-2.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script lang='ts'>
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { getLocalization } from '$lib/i18n';
|
import { getLocalization } from '$lib/i18n';
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
$: console.log(data, 'sorted, fina');
|
$: console.log(data, 'sorted, fina');
|
||||||
|
|
||||||
let player_names;
|
let player_names;
|
||||||
$: player_names = Object.keys(data).sort(function(a, b) {
|
$: player_names = Object.keys(data).sort(function (a, b) {
|
||||||
return data[b] - data[a];
|
return data[b] - data[a];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{#if i <= player_count_or_five - 1}
|
{#if i <= player_count_or_five - 1}
|
||||||
<p
|
<p
|
||||||
in:fly={{ y: -300, delay: player_count_or_five * 1200 - (i + 1) * 1000 }}
|
in:fly={{ y: -300, delay: player_count_or_five * 1200 - (i + 1) * 1000 }}
|
||||||
style='font-size: {player_count_or_five - i / 2}rem'
|
style="font-size: {player_count_or_five - i / 2}rem"
|
||||||
class='text-center'
|
class="text-center"
|
||||||
>
|
>
|
||||||
{$t('play_page.final_result_rank', {
|
{$t('play_page.final_result_rank', {
|
||||||
place: i + 1,
|
place: i + 1,
|
||||||
@@ -67,12 +67,12 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{#if data[username]}
|
{#if data[username]}
|
||||||
<div class='fixed bottom-0 left-0 flex justify-center w-full mb-6'>
|
<div class="fixed bottom-0 left-0 flex justify-center w-full mb-6">
|
||||||
<div class='mx-auto p-2 border-[#B07156] border-4 rounded'>
|
<div class="mx-auto p-2 border-[#B07156] border-4 rounded">
|
||||||
<p class='text-center'>{$t('play_page.your_score', { score: data[username] })}</p>
|
<p class="text-center">{$t('play_page.your_score', { score: data[username] })}</p>
|
||||||
{#each player_names as player, i}
|
{#each player_names as player, i}
|
||||||
{#if player === username}
|
{#if player === username}
|
||||||
<p class='text-center'>{$t('play_page.your_place', { place: i+1 })}</p>
|
<p class="text-center">{$t('play_page.your_place', { place: i + 1 })}</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
|
|
||||||
let quiz_answers = [];
|
let quiz_answers = [];
|
||||||
let quiz_colors = [];
|
let quiz_colors = [];
|
||||||
let answer_correct: boolean[] = []
|
let answer_correct: boolean[] = [];
|
||||||
|
|
||||||
for (const i of question.answers) {
|
for (const i of question.answers) {
|
||||||
quiz_answers.push(i.answer);
|
quiz_answers.push(i.answer);
|
||||||
quiz_colors.push(i.color);
|
quiz_colors.push(i.color);
|
||||||
answer_correct.push(i.right)
|
answer_correct.push(i.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sorted_data = {};
|
let sorted_data = {};
|
||||||
@@ -46,9 +46,12 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{#each quiz_answers as answer, i}
|
{#each quiz_answers as answer, i}
|
||||||
<div
|
<div
|
||||||
class="w-20 self-end flex justify-center border border-black shadow-xl rounded"
|
class="w-20 self-end flex justify-center border border-black shadow-xl rounded"
|
||||||
class:shadow-blue-500={answer_correct[i] && question.type !== QuizQuestionType.VOTING}
|
class:shadow-blue-500={answer_correct[i] &&
|
||||||
class:shadow-yellow-500={!answer_correct[i] && question.type !== QuizQuestionType.VOTING}
|
question.type !== QuizQuestionType.VOTING}
|
||||||
class:opacity-70={!answer_correct[i] && question.type !== QuizQuestionType.VOTING}
|
class:shadow-yellow-500={!answer_correct[i] &&
|
||||||
|
question.type !== QuizQuestionType.VOTING}
|
||||||
|
class:opacity-70={!answer_correct[i] &&
|
||||||
|
question.type !== QuizQuestionType.VOTING}
|
||||||
style="height: {(sorted_data[answer] * 20) /
|
style="height: {(sorted_data[answer] * 20) /
|
||||||
data.length}rem; background-color: {quiz_colors[i]
|
data.length}rem; background-color: {quiz_colors[i]
|
||||||
? quiz_colors[i]
|
? quiz_colors[i]
|
||||||
@@ -57,11 +60,15 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-12">
|
<div class="flex gap-12">
|
||||||
{#each quiz_answers as answer,i}
|
{#each quiz_answers as answer, i}
|
||||||
<div class="w-20">
|
<div class="w-20">
|
||||||
<p class="-rotate-45 text-xl text-str"
|
<p
|
||||||
class:line-through={!answer_correct[i] && question.type !== QuizQuestionType.VOTING}
|
class="-rotate-45 text-xl text-str"
|
||||||
>{@html answer}</p>
|
class:line-through={!answer_correct[i] &&
|
||||||
|
question.type !== QuizQuestionType.VOTING}
|
||||||
|
>
|
||||||
|
{@html answer}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -150,7 +150,9 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
class="flex flex-col justify-start"
|
class="flex flex-col justify-start"
|
||||||
style="height: {question.image ? '33.333333' : '16.666667'}%"
|
style="height: {question.image ? '33.333333' : '16.666667'}%"
|
||||||
>
|
>
|
||||||
<h1 class="lg:text-2xl text-lg text-center text-black dark:text-white mt-2 break-normal mb-2">
|
<h1
|
||||||
|
class="lg:text-2xl text-lg text-center text-black dark:text-white mt-2 break-normal mb-2"
|
||||||
|
>
|
||||||
{@html question.question}
|
{@html question.question}
|
||||||
</h1>
|
</h1>
|
||||||
{#if question.image !== null && game_mode !== 'kahoot'}
|
{#if question.image !== null && game_mode !== 'kahoot'}
|
||||||
|
|||||||
Reference in New Issue
Block a user