Merge pull request #409 from mawoka-myblock/testing

This commit is contained in:
Marlon
2024-10-18 12:03:50 +02:00
committed by GitHub
41 changed files with 7885 additions and 5477 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ SPDX-License-Identifier: MPL-2.0
{/if}
{/if}
<br />
{#if timer_res === '0' && JSON.stringify(final_results) === JSON.stringify( [null] ) && quiz_data.questions[selected_question].type !== QuizQuestionType.SLIDE && question_results !== null}
{#if timer_res === '0' && JSON.stringify(final_results) === JSON.stringify( [null] ) && quiz_data.questions[selected_question].type !== QuizQuestionType.SLIDE && question_results !== null && quiz_data.questions[selected_question]?.hide_results !== true}
{#if question_results === undefined}
{#if !final_results_clicked}
<div class="w-full flex justify-center">
@@ -4,6 +4,10 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
SPDX-License-Identifier: MPL-2.0
-->
<!--
This should be okay, right?
-->
<script lang="ts">
import { onMount } from 'svelte';
import { tinykeys } from '$lib/tinykeys';
@@ -194,7 +198,6 @@ SPDX-License-Identifier: MPL-2.0
};
const on_enter = (e: KeyboardEvent) => {
e.preventDefault();
if (selected === null) {
return;
}
@@ -231,6 +234,7 @@ SPDX-License-Identifier: MPL-2.0
<div
class="fixed top-0 left-0 w-screen h-screen flex bg-black bg-opacity-50 z-50"
on:click={close_on_outside}
on:keyup={close_on_outside}
transition:fade={{ duration: 60 }}
>
<div class="m-auto w-1/3 h-2/3 rounded bg-black flex flex-col">
@@ -242,7 +246,6 @@ SPDX-License-Identifier: MPL-2.0
</p>
<input
type="text"
autofocus
class="col-start-1 row-start-1 bg-transparent w-full p-4 outline-none bg-gray-700 rounded"
bind:value={input}
/>
+56 -6
View File
@@ -11,23 +11,27 @@ SPDX-License-Identifier: MPL-2.0
import { reach } from 'yup';
import { dataSchema } from '$lib/yupSchemas';
import Spinner from '../Spinner.svelte';
// import { createTippy } from 'svelte-tippy';
import { createTippy } from 'svelte-tippy';
import { getLocalization } from '$lib/i18n';
import MediaComponent from '$lib/editor/MediaComponent.svelte';
import { fade } from 'svelte/transition';
import BrownButton from '$lib/components/buttons/brown.svelte';
// import MediaComponent from "$lib/editor/MediaComponent.svelte";
const { t } = getLocalization();
/* const tippy = createTippy({
arrow: true,
animation: 'perspective-subtle',
placement: 'top'
});*/
const tippy = createTippy({
arrow: true,
animation: 'perspective-subtle',
placement: 'top'
});
export let data: EditorData;
export let selected_question: number;
export let edit_id: string;
let advanced_options_open = false;
let uppyOpen = false;
let unique = {};
@@ -93,6 +97,33 @@ SPDX-License-Identifier: MPL-2.0
<span
class="inline-block bg-gray-600 w-4 h-4 rounded-full hover:bg-green-400 transition"
/>
<button
class="ml-auto"
type="button"
use:tippy={{ content: $t('editor.advanced_settings') }}
on:click={() => (advanced_options_open = true)}
>
<svg
class="text-white w-5 h-5"
aria-hidden="true"
fill="none"
stroke="white"
stroke-width="2"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
stroke-linecap="round"
stroke-linejoin="round"
></path>
<path
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
</button>
</div>
</div>
{#if data.questions[selected_question].type === QuizQuestionType.SLIDE}
@@ -233,3 +264,22 @@ SPDX-License-Identifier: MPL-2.0
{/if}
</div>
</div>
{#if advanced_options_open}
<div
class="fixed top-0 left-0 w-full h-full bg-black/60 flex"
transition:fade={{ duration: 150 }}
>
<div class="w-1/4 h-1/3 m-auto bg-white dark:bg-gray-700 rounded-lg flex flex-col p-2 gap-2">
<h1 class="text-3xl mx-auto">{$t('editor.advanced_settings')}</h1>
<label class="flex justify-around text-lg">
<span class="my-auto">{$t('editor.hide_question_results')}</span>
<input type="checkbox" bind:checked={data.questions[selected_question]["hide_results"]} />
</label>
<div class="mt-auto w-full">
<BrownButton on:click={() => (advanced_options_open = false)}>{$t('words.close')}</BrownButton>
</div>
</div>
</div>
{/if}
+3 -1
View File
@@ -231,7 +231,9 @@
"enter_answer": "Gib eine Antwort ein",
"visit_docs": "Besuche die Dokumentation.",
"enable_reorder": "Fragen Umsortieren",
"disable_reorder": "Umsortieren beenden"
"disable_reorder": "Umsortieren beenden",
"advanced_settings": "Erweiterte Einstellungen",
"hide_question_results": "Frageergebnisse ausblenden?"
},
"import": {
"need_help": "",
+3 -1
View File
@@ -226,7 +226,9 @@
"visit_docs": "Visit the docs.",
"enter_answer": "Enter an answer",
"enable_reorder": "Enable reorder mode",
"disable_reorder": "Disable reorder mode"
"disable_reorder": "Disable reorder mode",
"advanced_settings": "Advanced Settings",
"hide_question_results": "Hide question resuluts?"
},
"import_page": {
"need_help": "Need help?",
@@ -79,6 +79,17 @@ SPDX-License-Identifier: MPL-2.0
class="admin-button"
>{$t('admin_page.next_question', { question: selected_question + 2 })}
</button>
{:else if quiz_data.questions[selected_question]?.hide_results === true}
<button
on:click={() => {
get_question_results();
setTimeout(() => {
set_question_number(selected_question + 1);
}, 200);
}}
class="admin-button"
>{$t('admin_page.next_question', { question: selected_question + 2 })}
</button>
{:else}
<button on:click={get_question_results} class="admin-button"
>{$t('admin_page.show_results')}
+1
View File
@@ -61,6 +61,7 @@ export interface Question {
type?: QuizQuestionType;
image?: string;
answers: Answers;
hide_results?: boolean;
}
export type Answers =
+18
View File
@@ -259,6 +259,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_create_thing = SelectedCreateThing.Create;
}}
on:keyup={() => {
selected_create_thing = SelectedCreateThing.Create;
}}
class:shadow-2xl={selected_create_thing === SelectedCreateThing.Create}
class:opacity-70={selected_create_thing !== SelectedCreateThing.Create}
>
@@ -289,6 +292,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_create_thing = SelectedCreateThing.Find;
}}
on:keyup={() => {
selected_create_thing = SelectedCreateThing.Find;
}}
class:shadow-2xl={selected_create_thing === SelectedCreateThing.Find}
class:opacity-70={selected_create_thing !== SelectedCreateThing.Find}
>
@@ -396,6 +402,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_play_thing = SelectedPlayThing.Select;
}}
on:keyup={() => {
selected_play_thing = SelectedPlayThing.Select;
}}
class:shadow-2xl={selected_play_thing === SelectedPlayThing.Select}
class:opacity-70={selected_play_thing !== SelectedPlayThing.Select}
>
@@ -426,6 +435,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_play_thing = SelectedPlayThing.Results;
}}
on:keyup={() => {
selected_play_thing = SelectedPlayThing.Results;
}}
class:shadow-2xl={selected_play_thing === SelectedPlayThing.Results}
class:opacity-70={selected_play_thing !== SelectedPlayThing.Results}
>
@@ -456,6 +468,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_play_thing = SelectedPlayThing.Winners;
}}
on:keyup={() => {
selected_play_thing = SelectedPlayThing.Winners;
}}
class:shadow-2xl={selected_play_thing === SelectedPlayThing.Winners}
class:opacity-70={selected_play_thing !== SelectedPlayThing.Winners}
>
@@ -511,6 +526,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_classquiz_reason = index;
}}
on:keyup={() => {
selected_classquiz_reason = index;
}}
class:shadow-2xl={selected_classquiz_reason === index}
class:opacity-70={selected_classquiz_reason !== index}
>
@@ -33,6 +33,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_method = 'PASSKEY';
}}
on:keyup={() => {
selected_method = 'PASSKEY';
}}
>
<!-- heroicons/key -->
<svg
@@ -61,6 +64,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_method = 'PASSWORD';
}}
on:keyup={() => {
selected_method = 'PASSWORD';
}}
>
<!-- iconoir/password-cursor -->
<svg
@@ -104,6 +110,9 @@ SPDX-License-Identifier: MPL-2.0
on:click={() => {
selected_method = 'TOTP';
}}
on:keyup={() => {
selected_method = 'TOTP';
}}
>
<!-- heroicons/clock -->
<svg
@@ -4,6 +4,8 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
SPDX-License-Identifier: MPL-2.0
-->
<script lang="ts">
import { getLocalization } from '$lib/i18n';
import OAuthBlock from './oauth_block.svelte';
@@ -17,11 +19,13 @@ SPDX-License-Identifier: MPL-2.0
let isSubmitting = false;
$: emailEmpty = email === '';
const start_login = async (): Promise<void> => {
if (emailEmpty) {
return;
}
isSubmitting = true;
const res = await fetch('/api/v1/login/start', {
method: 'post',
headers: {
+3
View File
@@ -60,6 +60,9 @@ SPDX-License-Identifier: MPL-2.0
connect();
}
});
socket.on("session_id", (d) => {
const session_id = d.session_id
})
socket.on('registered_as_admin', (data) => {
quiz_data = JSON.parse(data['game']);
+3
View File
@@ -72,6 +72,9 @@ SPDX-License-Identifier: MPL-2.0
socket.on('time_sync', (data) => {
socket.emit('echo_time_sync', data);
});
socket.on("session_id", (d) => {
const session_id = d.session_id
})
socket.on('connect', async () => {
console.log('Connected!');