diff --git a/frontend/src/lib/admin.svelte b/frontend/src/lib/admin.svelte index 80bc48e..f94f088 100644 --- a/frontend/src/lib/admin.svelte +++ b/frontend/src/lib/admin.svelte @@ -12,7 +12,7 @@ SPDX-License-Identifier: MPL-2.0 import Controls from '$lib/play/admin/controls.svelte'; import Question from '$lib/play/admin/question.svelte'; import { SocketGameControls } from '$lib/play/admin/socket_game_controls.ts'; - import { GameState } from '$lib/play/admin/game_state.ts'; + import type { IGameState } from '$lib/play/admin/game_state.ts'; const { t } = getLocalization(); const default_colors = ['#D6EDC9', '#B07156', '#7F7057', '#4E6E58']; @@ -23,14 +23,10 @@ SPDX-License-Identifier: MPL-2.0 interface Props { game_token: string; bg_color: string; - game_state: GameState; + game_state: IGameState; } - let { - game_token, - bg_color, - game_state = $bindable() - }: Props = $props(); + let { game_token, bg_color, game_state = $bindable() }: Props = $props(); socket.on('get_question_results', () => { console.log('get_question_results'); @@ -89,33 +85,41 @@ SPDX-License-Identifier: MPL-2.0 {#if game_state.control_visible} - + {/if} {#if game_state.timer_res !== '0' && game_state.selected_question >= 0} {/if} -
+
{#if game_state.timer_res !== undefined && !final_results_clicked && !game_state.question_results} {#if game_state.quiz_data.questions[game_state.selected_question].type === QuizQuestionType.SLIDE} {#await import('$lib/play/admin/slide.svelte')} {:then c} - + {/await} {:else} - + {/if} {/if}
diff --git a/frontend/src/lib/play/admin/controls.svelte b/frontend/src/lib/play/admin/controls.svelte index 5141da4..9f6960c 100644 --- a/frontend/src/lib/play/admin/controls.svelte +++ b/frontend/src/lib/play/admin/controls.svelte @@ -8,7 +8,7 @@ SPDX-License-Identifier: MPL-2.0 import { QuizQuestionType } from '$lib/quiz_types'; import { getLocalization } from '$lib/i18n'; import { SocketGameControls } from '$lib/play/admin/socket_game_controls.ts'; - import { GameState } from '$lib/play/admin/game_state.ts'; + import type { GameState } from '$lib/play/admin/game_state.ts'; interface Props { bg_color: string; @@ -17,12 +17,7 @@ SPDX-License-Identifier: MPL-2.0 game_state: GameState; } - let { - bg_color, - socket_game_controls, - game_token, - game_state = $bindable() - }: Props = $props(); + let { bg_color, socket_game_controls, game_token, game_state = $bindable() }: Props = $props(); const { t } = getLocalization(); @@ -44,7 +39,9 @@ SPDX-License-Identifier: MPL-2.0
{#if game_state.selected_question + 1 === game_state.quiz_data.questions.length && ((game_state.timer_res === '0' && game_state.question_results !== null) || game_state.quiz_data?.questions?.[game_state.selected_question]?.type === QuizQuestionType.SLIDE)} {#if JSON.stringify(game_state.final_results) === JSON.stringify([null])} - {/if} @@ -55,31 +52,50 @@ SPDX-License-Identifier: MPL-2.0 socket_game_controls.set_question_number(game_state.selected_question + 1); }} class="admin-button" - >{$t('admin_page.next_question', { question: game_state.selected_question + 2 })} + >{$t('admin_page.next_question', { + question: game_state.selected_question + 2 + })} {/if} {#if game_state.question_results === null && game_state.selected_question !== -1} {#if game_state.quiz_data.questions[game_state.selected_question].type === QuizQuestionType.SLIDE} {:else if game_state.quiz_data.questions[game_state.selected_question]?.hide_results === true} {:else} - {/if} @@ -91,7 +107,9 @@ SPDX-License-Identifier: MPL-2.0 socket_game_controls.set_question_number(game_state.selected_question + 1); }} class="admin-button" - >{$t('admin_page.next_question', { question: game_state.selected_question + 2 })} + >{$t('admin_page.next_question', { + question: game_state.selected_question + 2 + })} {:else}