diff --git a/frontend/src/lib/dashboard/start_game.svelte b/frontend/src/lib/dashboard/start_game.svelte new file mode 100644 index 0000000..3502ce0 --- /dev/null +++ b/frontend/src/lib/dashboard/start_game.svelte @@ -0,0 +1,117 @@ + + + +
+
+
+ +
+ +
+
{ + selected_game_mode = 'normal'; + }} + > +

Normal

+

+ Questions, images and answers will be shown on both admins screen and on the + screen of the players +

+
+
{ + selected_game_mode = 'kahoot'; + }} + > +

Kahoot!-Like [EARLY BETA]

+

+ Question and answer will only be shown on admins screen, like Kahoot!. The + players will only have colored buttons with symbols matching these on the screen + of the admin. +

+
+
+ + +
+
diff --git a/frontend/src/lib/dashboard/start_game.ts b/frontend/src/lib/dashboard/start_game.ts deleted file mode 100644 index eaebc60..0000000 --- a/frontend/src/lib/dashboard/start_game.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -import { alertModal } from '$lib/stores'; -import { captcha_enabled } from '$lib/config'; - -export const start_game = async (id: string) => { - let res; - if (captcha_enabled && window.confirm('Do you want to enable the captcha for players?')) { - res = await fetch(`/api/v1/quiz/start/${id}?captcha_enabled=True`, { - method: 'POST' - }); - } else { - res = await fetch(`/api/v1/quiz/start/${id}?captcha_enabled=False`, { - method: 'POST' - }); - } - - if (res.status !== 200) { - alertModal.set({ - open: true, - title: 'Start failed', - body: `Failed to start game, ${await res.text()}` - }); - alertModal.subscribe((_) => { - window.location.assign('/account/login?returnTo=/dashboard'); - }); - } else { - const data = await res.json(); - // eslint-disable-next-line no-undef - plausible('Started Game', { props: { quiz_id: id } }); - window.location.assign(`/admin?token=${data.game_id}&pin=${data.game_pin}&connect=1`); - } -};