From 4f220bf8107f885d21a3b0dbd31042a860fc3dbf Mon Sep 17 00:00:00 2001
From: Mawoka
Date: Thu, 29 Sep 2022 12:15:18 +0200
Subject: [PATCH] :sparkles: Improved buttons in kahoot-mode
---
frontend/src/app.css | 3 +
frontend/src/lib/admin.svelte | 56 ++++++++++---------
frontend/src/lib/dashboard/main_slider.svelte | 2 +-
frontend/src/routes/admin/+page.svelte | 6 +-
.../src/routes/view/[quiz_id]/+page.svelte | 7 +--
5 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/frontend/src/app.css b/frontend/src/app.css
index dabe700..4e0de9d 100644
--- a/frontend/src/app.css
+++ b/frontend/src/app.css
@@ -28,4 +28,7 @@
.normal-background {
@apply bg-gradient-to-r from-[#009444] via-[#39b54a] to-[#8dc63f] dark:bg-[#0f2702] dark:from-[#0f2702] dark:via-[#0f2702] dark:to[#0f2702];
}
+ .admin-button {
+ @apply 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;
+ }
}
diff --git a/frontend/src/lib/admin.svelte b/frontend/src/lib/admin.svelte
index 27db7dc..0662483 100644
--- a/frontend/src/lib/admin.svelte
+++ b/frontend/src/lib/admin.svelte
@@ -92,7 +92,6 @@
circular_prgoress = 0;
}
}
- $: console.log(quiz_data.questions.length, 'length of quiz');
{#if game_mode === 'kahoot'}
@@ -105,38 +104,47 @@
{selected_question === -1 ? '0' : selected_question + 1}
/{quiz_data.questions.length}
- {#if selected_question >= 0}
+ {#if selected_question >= 0 && JSON.stringify(final_results) === JSON.stringify([null])}
{quiz_data.questions[selected_question].question}
{timer_res}
{/if}
- {#if selected_question + 1 === quiz_data.questions.length && timer_res === '0'}
+ {#if selected_question + 1 === quiz_data.questions.length && timer_res === '0' && question_results !== null}
{#if JSON.stringify(final_results) === JSON.stringify([null])}
-
+
{/if}
{:else if timer_res === '0' || selected_question === -1}
-
+ {#if (selected_question + 1 !== quiz_data.questions.length && question_results !== null) || selected_question === -1}
+
+ {/if}
{#if question_results === null && selected_question !== -1}
-
+
{/if}
{:else if selected_question !== -1}
-
+
{:else}
-
!OK!
-
+ -->
{/if}
@@ -196,15 +204,14 @@
{/if}
{/if}
- {#if timer_res === '0'}
+ {#if timer_res === '0' && JSON.stringify(final_results) === JSON.stringify([null])}
{#if question_results === null}
{#if game_mode === 'normal'}
{$t('admin_page.get_results')}
{/if}
@@ -233,8 +240,7 @@
timer_res = '0';
}}
id="GetQuestionResultsAndStopTime"
- 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"
- >{$t('admin_page.stop_time')}{$t('admin_page.stop_time')}
{/if}
@@ -244,7 +250,7 @@
{#if game_mode === 'normal'}
@@ -273,9 +279,7 @@
{:else if final_results_clicked === false}
{#if game_mode === 'normal'}
-
diff --git a/frontend/src/lib/dashboard/main_slider.svelte b/frontend/src/lib/dashboard/main_slider.svelte
index 70ba792..55eee97 100644
--- a/frontend/src/lib/dashboard/main_slider.svelte
+++ b/frontend/src/lib/dashboard/main_slider.svelte
@@ -10,7 +10,7 @@
import 'swiper/css/navigation';
import { Pagination, EffectCoverflow, Keyboard, Mousewheel, Navigation } from 'swiper';
import { QuizQuestionType } from '$lib/quiz_types.js';
- import { getLocalization } from '../i18n';
+ import { getLocalization } from '$lib/i18n';
import StartGamePopup from './start_game.svelte';
import { onMount } from 'svelte';
diff --git a/frontend/src/routes/admin/+page.svelte b/frontend/src/routes/admin/+page.svelte
index 0e496fe..121d9a4 100644
--- a/frontend/src/routes/admin/+page.svelte
+++ b/frontend/src/routes/admin/+page.svelte
@@ -135,9 +135,7 @@
>
{#if JSON.stringify(final_results) !== JSON.stringify([null])}
-
@@ -189,7 +187,7 @@
{#if players.length > 0}