diff --git a/frontend/src/lib/editor.svelte b/frontend/src/lib/editor.svelte index 3c3fd5a..77c2c6f 100644 --- a/frontend/src/lib/editor.svelte +++ b/frontend/src/lib/editor.svelte @@ -5,6 +5,7 @@ import type { EditorData, Question, Answer } from './quiz_types'; import Sidebar from '$lib/editor/sidebar.svelte'; import SettingsCard from '$lib/editor/settings-card.svelte'; + import QuizCard from '$lib/editor/card.svelte'; const { t } = getLocalization(); @@ -68,9 +69,38 @@
-
- {#if selected_question === -1} - - {/if} +
+
+ {#if schemaInvalid} +

{yupErrorMessage}

+ {/if} + +
+
+ {#if selected_question === -1} + + {:else} + + {/if} +
diff --git a/frontend/src/lib/editor/card.svelte b/frontend/src/lib/editor/card.svelte new file mode 100644 index 0000000..011a2e9 --- /dev/null +++ b/frontend/src/lib/editor/card.svelte @@ -0,0 +1,127 @@ + + +
+
+
+
+ + + +
+
+
+
+ +
+
+ not available +
+
+
+ {#each question.answers as answer, index} +
{ + question.answers.splice(index, 1); + question.answers = question.answers; + }} + class="p-4 rounded-lg flex justify-center w-full" + class:bg-red-500={!answer.right} + class:bg-green-500={answer.right} + class:bg-yellow-500={!reach( + dataSchema, + 'questions[].answers[].answer' + ).isValidSync(answer.answer)} + > + + +
+ {/each} + {#if question.answers.length < 4} + + {/if} +
+
+

Right-click on an answer to delete it!

+
+
+
diff --git a/frontend/src/lib/editor/checker-bg.svg b/frontend/src/lib/editor/checker-bg.svg new file mode 100644 index 0000000..2996684 --- /dev/null +++ b/frontend/src/lib/editor/checker-bg.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/lib/editor/settings-card.svelte b/frontend/src/lib/editor/settings-card.svelte index 9707d8d..4f47e91 100644 --- a/frontend/src/lib/editor/settings-card.svelte +++ b/frontend/src/lib/editor/settings-card.svelte @@ -4,7 +4,7 @@ export let data: EditorData; -
+
@@ -24,9 +24,59 @@
+
+