Formatted files

This commit is contained in:
Mawoka
2023-10-01 11:11:15 +02:00
parent 8cfc4caef1
commit beb72b2173
2 changed files with 38 additions and 37 deletions
@@ -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 AudioPlayer from '$lib/play/audio_player.svelte'; import AudioPlayer from '$lib/play/audio_player.svelte';
import ControllerCodeDisplay from '$lib/components/controller/code.svelte'; import ControllerCodeDisplay from '$lib/components/controller/code.svelte';
import { getLocalization } from '$lib/i18n'; import { getLocalization } from '$lib/i18n';
@@ -35,11 +35,11 @@ SPDX-License-Identifier: MPL-2.0
}; };
</script> </script>
<div class='w-full h-full'> <div class="w-full h-full">
<AudioPlayer bind:play={play_music} /> <AudioPlayer bind:play={play_music} />
<div class='grid grid-cols-3 mt-12'> <div class="grid grid-cols-3 mt-12">
<div class='flex justify-center'> <div class="flex justify-center">
<p class='m-auto text-2xl'> <p class="m-auto text-2xl">
{$t('play_page.join_description', { {$t('play_page.join_description', {
url: url:
window.location.host === 'classquiz.de' window.location.host === 'classquiz.de'
@@ -50,45 +50,46 @@ SPDX-License-Identifier: MPL-2.0
</p> </p>
</div> </div>
<img <img
alt='QR code to join the game' alt="QR code to join the game"
src='/api/v1/utils/qr/{game_pin}' src="/api/v1/utils/qr/{game_pin}"
class='block mx-auto w-1/2 dark:bg-white shadow-2xl rounded' class="block mx-auto w-1/2 dark:bg-white shadow-2xl rounded"
/> />
{#if cqc_code} {#if cqc_code}
<div class='m-auto'> <div class="m-auto">
<div class='flex-col flex justify-center'> <div class="flex-col flex justify-center">
<p class='mx-auto'>{$t('play_page.join_by_entering_code')}</p> <p class="mx-auto">{$t('play_page.join_by_entering_code')}</p>
<ControllerCodeDisplay code={cqc_code} /> <ControllerCodeDisplay code={cqc_code} />
</div> </div>
</div> </div>
{/if} {/if}
</div> </div>
<p class='text-3xl text-center'>{$t('words.pin')}: <span class='select-all'>{game_pin}</span></p> <p class="text-3xl text-center">
<div class='flex justify-center w-full mt-4'> {$t('words.pin')}: <span class="select-all">{game_pin}</span>
</p>
<div class="flex justify-center w-full mt-4">
<div> <div>
<GrayButton <GrayButton
disabled={players.length < 1} disabled={players.length < 1}
on:click={() => { on:click={() => {
socket.emit('start_game', ''); socket.emit('start_game', '');
}} }}
>{$t('admin_page.start_game')} >{$t('admin_page.start_game')}
</GrayButton> </GrayButton>
</div> </div>
</div> </div>
<div class='flex flex-row w-full mt-4 px-10 flex-wrap'> <div class="flex flex-row w-full mt-4 px-10 flex-wrap">
{#if players.length > 0} {#if players.length > 0}
{#each players as player} {#each players as player}
<div class='p-2 m-2 border-2 border-[#B07156] rounded hover:cursor-pointer'> <div class="p-2 m-2 border-2 border-[#B07156] rounded hover:cursor-pointer">
<span <span
class='hover:line-through text-lg' class="hover:line-through text-lg"
on:click={() => { on:click={() => {
kick_player(player.username); kick_player(player.username);
}}>{player.username}</span }}>{player.username}</span
> >
<!-- <button>{$t('words.kick')}</button>--> <!-- <button>{$t('words.kick')}</button>-->
</div> </div>
{/each} {/each}
{/if} {/if}
</div> </div>
</div> </div>
+14 -14
View File
@@ -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 VotingResults from './voting_results.svelte'; import VotingResults from './voting_results.svelte';
import { flip } from 'svelte/animate'; import { flip } from 'svelte/animate';
import { fly } from 'svelte/transition'; import { fly } from 'svelte/transition';
@@ -58,7 +58,7 @@ SPDX-License-Identifier: MPL-2.0
} }
$: data = sortObjectbyValue(data); $: data = sortObjectbyValue(data);
$: 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];
}); });
@@ -94,30 +94,30 @@ SPDX-License-Identifier: MPL-2.0
// https://svelte.dev/repl/96a58afdea2248a5b7e489160ffba887?version=3.44.2 // https://svelte.dev/repl/96a58afdea2248a5b7e489160ffba887?version=3.44.2
</script> </script>
<div class='h-full flex flex-col'> <div class="h-full flex flex-col">
<div class='flex justify-center'> <div class="flex justify-center">
<div> <div>
<table class='table-auto text-xl'> <table class="table-auto text-xl">
<tr> <tr>
<th class='p-2 border-r border-r-black border-b-2 border-b-black' <th class="p-2 border-r border-r-black border-b-2 border-b-black"
>{$t('words.name')}</th >{$t('words.name')}</th
> >
<th class='p-2 border-b-2 border-b-black'>{$t('words.point', { count: 2 })}</th> <th class="p-2 border-b-2 border-b-black">{$t('words.point', { count: 2 })}</th>
{#if show_new_score_clicked} {#if show_new_score_clicked}
<th in:fly={{ x: 300 }} class='p-2 border-b-2 border-b-black' <th in:fly={{ x: 300 }} class="p-2 border-b-2 border-b-black"
>{$t('play_page.points_added')} >{$t('play_page.points_added')}
</th> </th>
{/if} {/if}
</tr> </tr>
{#each player_names as player, i (player)} {#each player_names as player, i (player)}
<tr animate:flip> <tr animate:flip>
<td class:hidden={i > 3} class='p-2 border-r border-r-black'>{player}</td> <td class:hidden={i > 3} class="p-2 border-r border-r-black">{player}</td>
<td class:hidden={i > 3} class='p-2'>{data[player]}</td> <td class:hidden={i > 3} class="p-2">{data[player]}</td>
{#if show_new_score_clicked} {#if show_new_score_clicked}
<td <td
in:fly={{ x: 300 }} in:fly={{ x: 300 }}
class:hidden={i > 3} class:hidden={i > 3}
class='p-2' class="p-2"
class:text-red-600={score_by_username[player] === 0 || class:text-red-600={score_by_username[player] === 0 ||
score_by_username[player] === undefined} score_by_username[player] === undefined}
> >
@@ -130,7 +130,7 @@ SPDX-License-Identifier: MPL-2.0
</div> </div>
</div> </div>
{#if [QuizQuestionType.ABCD, QuizQuestionType.VOTING, QuizQuestionType.TEXT].includes(question.type)} {#if [QuizQuestionType.ABCD, QuizQuestionType.VOTING, QuizQuestionType.TEXT].includes(question.type)}
<div class='mt-12'> <div class="mt-12">
<VotingResults data={new_data} {question} /> <VotingResults data={new_data} {question} />
</div> </div>
{/if} {/if}