+
{#if type === PopoverTypes.Copy}
{$t('components.popover.copied_to_clipboard')}
{:else if type === PopoverTypes.GameInLobby}A game is currently in the lobby. Click
here to join as a remote.
+ class="underline"
+ href="/remote?game_pin={data.game_pin}&game_id={data.game_id}">here to join as a remote.
{:else if type === PopoverTypes.Generic}
{@html data}
{:else}
@@ -42,26 +42,26 @@ SPDX-License-Identifier: MPL-2.0
{/if}
{
open = false;
}}
>
- {$t('words.close')}
+ {$t('words.close')}
diff --git a/frontend/src/lib/play/admin/controls.svelte b/frontend/src/lib/play/admin/controls.svelte
new file mode 100644
index 00000000..c216bc87
--- /dev/null
+++ b/frontend/src/lib/play/admin/controls.svelte
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ {selected_question === -1 ? '0' : selected_question + 1}
+ /{quiz_data.questions.length}
+
+
+ {#if selected_question + 1 === quiz_data.questions.length && ((timer_res === '0' && question_results !== null) || quiz_data?.questions?.[selected_question]?.type === QuizQuestionType.SLIDE)}
+ {#if JSON.stringify(final_results) === JSON.stringify([null])}
+ {$t('admin_page.get_final_results')}
+
+ {/if}
+ {:else if timer_res === '0' || selected_question === -1}
+ {#if (selected_question + 1 !== quiz_data.questions.length && question_results !== null) || selected_question === -1}
+ {
+ set_question_number(selected_question + 1);
+ }}
+ class="admin-button"
+ >{$t('admin_page.next_question', { question: selected_question + 2 })}
+
+ {/if}
+ {#if question_results === null && selected_question !== -1}
+ {#if quiz_data.questions[selected_question].type === QuizQuestionType.SLIDE}
+ {
+ set_question_number(selected_question + 1);
+ }}
+ class="admin-button"
+ >{$t('admin_page.next_question', { question: selected_question + 2 })}
+
+ {:else}
+ {$t('admin_page.show_results')}
+
+ {/if}
+ {/if}
+ {:else if selected_question !== -1}
+ {#if quiz_data.questions[selected_question].type === QuizQuestionType.SLIDE}
+ {
+ set_question_number(selected_question + 1);
+ }}
+ class="admin-button"
+ >{$t('admin_page.next_question', { question: selected_question + 2 })}
+
+ {:else}
+ {$t('admin_page.stop_time_and_solutions')}
+
+ {/if}
+ {/if}
+
+
diff --git a/frontend/src/lib/play/admin/question.svelte b/frontend/src/lib/play/admin/question.svelte
new file mode 100644
index 00000000..a9e6265e
--- /dev/null
+++ b/frontend/src/lib/play/admin/question.svelte
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+ {@html quiz_data.questions[selected_question].question}
+
+
+
+
+
+
+
+
+ {$t('admin_page.answers_submitted', { answer_count: answer_count })}
+
+
+
+{#if quiz_data.questions[selected_question].image !== null}
+
+
+
+{/if}
+{#if quiz_data.questions[selected_question].type === QuizQuestionType.ABCD || quiz_data.questions[selected_question].type === QuizQuestionType.VOTING || quiz_data.questions[selected_question].type === QuizQuestionType.CHECK}
+
+ {#each quiz_data.questions[selected_question].answers as answer, i}
+
+
+
{answer.answer}
+
+
+ {/each}
+
+{:else if quiz_data.questions[selected_question].type === QuizQuestionType.TEXT}
+ {#if timer_res === '0'}
+
+ {#each quiz_data.questions[selected_question].answers as answer, i}
+
+ {answer.answer}
+
+
+ {/each}
+
+ {:else}
+
+
{$t('admin_page.enter_answer_into_field')}
+
+ {/if}
+{/if}
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte
index 48093b75..b722761d 100644
--- a/frontend/src/routes/dashboard/+page.svelte
+++ b/frontend/src/routes/dashboard/+page.svelte
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MPL-2.0
import { getLocalization } from '$lib/i18n';
import Footer from '$lib/footer.svelte';
import { navbarVisible, signedIn } from '$lib/stores';
- import CommandpaletteNotice from "$lib/components/popover/commandpalettenotice.svelte"
+ import CommandpaletteNotice from '$lib/components/popover/commandpalettenotice.svelte';
// import Spinner from "$lib/Spinner.svelte";
import Fuse from 'fuse.js';
import BrownButton from '$lib/components/buttons/brown.svelte';
diff --git a/frontend/src/routes/play/+page.svelte b/frontend/src/routes/play/+page.svelte
index de751723..6ed103ae 100644
--- a/frontend/src/routes/play/+page.svelte
+++ b/frontend/src/routes/play/+page.svelte
@@ -73,42 +73,45 @@ SPDX-License-Identifier: MPL-2.0
socket.emit('echo_time_sync', data);
});
- socket.on("connect", async () => {
- console.log("Connected!")
- const cookie_data = Cookies.get("joined_game")
+ socket.on('connect', async () => {
+ console.log('Connected!');
+ const cookie_data = Cookies.get('joined_game');
if (!cookie_data) {
- return
+ return;
}
- const data = JSON.parse(cookie_data)
- socket.emit("rejoin_game", {old_sid: data.sid, username: data.username, game_pin: data.game_pin})
- const res = await fetch(
- `/api/v1/quiz/play/check_captcha/${game_pin}`
- );
+ const data = JSON.parse(cookie_data);
+ socket.emit('rejoin_game', {
+ old_sid: data.sid,
+ username: data.username,
+ game_pin: data.game_pin
+ });
+ const res = await fetch(`/api/v1/quiz/play/check_captcha/${game_pin}`);
const json = await res.json();
game_mode = json.game_mode;
- })
+ });
// Socket-events
socket.on('joined_game', (data) => {
gameData = data;
// eslint-disable-next-line no-undef
plausible('Joined Game', { props: { game_id: gameData.game_id } });
- Cookies.set("joined_game", JSON.stringify({sid: socket.id, username, game_pin}), {expires: 3600})
+ Cookies.set('joined_game', JSON.stringify({ sid: socket.id, username, game_pin }), {
+ expires: 3600
+ });
});
socket.on('rejoined_game', (data) => {
gameData = data;
if (data.started) {
- gameMeta.started = true
+ gameMeta.started = true;
}
-
});
socket.on('game_not_found', () => {
- const cookie_data = Cookies.get("joined_game")
+ const cookie_data = Cookies.get('joined_game');
if (cookie_data) {
- Cookies.remove("joined_game")
- window.location.reload()
- return
+ Cookies.remove('joined_game');
+ window.location.reload();
+ return;
}
game_pin_valid = false;
});
@@ -127,7 +130,7 @@ SPDX-License-Identifier: MPL-2.0
socket.on('question_results', (data) => {
restart();
- answer_results = data
+ answer_results = data;
});
socket.on('username_already_exists', () => {
@@ -144,7 +147,7 @@ SPDX-License-Identifier: MPL-2.0
});
socket.on('final_results', (data) => {
final_results = data;
- Cookies.remove("joined_game")
+ Cookies.remove('joined_game');
});
socket.on('solutions', (data) => {
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index 81ac8fbc..01af05b6 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -37,6 +37,7 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
- "resolveJsonModule": true
+ "resolveJsonModule": true,
+ "allowImportingTsExtensions": true
}
}
diff --git a/simulate_players.py b/simulate_players.py
index 60a4f1a6..df1cc613 100644
--- a/simulate_players.py
+++ b/simulate_players.py
@@ -8,7 +8,7 @@
import socketio
NUMBER_OF_PLAYERS = 200
-GAME_PIN = 563037
+GAME_PIN = sys.argv[1]
q_index = 0