diff --git a/frontend/src/lib/editor.svelte b/frontend/src/lib/editor.svelte
index 8396fcc..3c3fd5a 100644
--- a/frontend/src/lib/editor.svelte
+++ b/frontend/src/lib/editor.svelte
@@ -2,33 +2,18 @@
import { getLocalization } from '$lib/i18n';
import * as yup from 'yup';
import { dataSchema } from '$lib/yupSchemas';
+ import type { EditorData, Question, Answer } from './quiz_types';
+ import Sidebar from '$lib/editor/sidebar.svelte';
+ import SettingsCard from '$lib/editor/settings-card.svelte';
const { t } = getLocalization();
let schemaInvalid = false;
let yupErrorMessage = '';
- interface Data {
- public: boolean;
- title: string;
- description: string;
- questions: Question[];
- }
-
- interface Question {
- question: string;
- time: string;
- image?: string;
- answers: Answer[];
- }
-
- interface Answer {
- right: boolean;
- answer: string;
- }
-
- export let data: Data;
+ export let data: EditorData;
export let submit_button_text = 'Create';
+ let selected_question = -1;
let imgur_links_valid = false;
const empty_question: Question = {
@@ -43,7 +28,7 @@
]
};
- const validateInput = async (data: Data) => {
+ const validateInput = async (data: EditorData) => {
try {
await dataSchema.validate(data, { abortEarly: false });
schemaInvalid = false;
@@ -79,189 +64,13 @@
};
-
-
-
-{#each data.questions as question, index_question}
-
-
{$t('words.question')} {index_question + 1}
-
-
-
-
- {#each question.answers as answer, index_answer}
-
-
{$t('words.answer')} {index_answer + 1}
-
- {$t('words.answer')}: {index_answer + 1}
- {$t('words.question')}: {index_question + 1}
-
-
-
-
-
-
- {/each}
-
-
+
+
+
-{/each}
-
-{#if imgur_links_valid}
-
- {$t('editor.not_all_links_imgur_links')}
-
-{/if}
-{#if schemaInvalid}
-
- {yupErrorMessage}
-
-{/if}
-
+
+ {#if selected_question === -1}
+
+ {/if}
+
+
diff --git a/frontend/src/lib/editor/settings-card.svelte b/frontend/src/lib/editor/settings-card.svelte
new file mode 100644
index 0000000..9707d8d
--- /dev/null
+++ b/frontend/src/lib/editor/settings-card.svelte
@@ -0,0 +1,32 @@
+
+
+
diff --git a/frontend/src/lib/editor/sidebar.svelte b/frontend/src/lib/editor/sidebar.svelte
new file mode 100644
index 0000000..205f54c
--- /dev/null
+++ b/frontend/src/lib/editor/sidebar.svelte
@@ -0,0 +1,192 @@
+
+
+
diff --git a/frontend/src/lib/quiz_types.ts b/frontend/src/lib/quiz_types.ts
index 35b87b9..2ab7cce 100644
--- a/frontend/src/lib/quiz_types.ts
+++ b/frontend/src/lib/quiz_types.ts
@@ -20,6 +20,13 @@ export interface Answer {
answer: string;
}
+export interface EditorData {
+ public: boolean;
+ title: string;
+ description: string;
+ questions: Question[];
+}
+
// TODO Keep an eye on this shit
// export interface Answer {
// username: string;
diff --git a/frontend/src/routes/create.svelte b/frontend/src/routes/create.svelte
index a801af3..acf1e8c 100644
--- a/frontend/src/routes/create.svelte
+++ b/frontend/src/routes/create.svelte
@@ -11,6 +11,7 @@
if (session.authenticated) {
signedIn.set(true);
}
+ return {};
}
@@ -21,7 +22,7 @@
import { navbarVisible } from '$lib/stores';
import { dataSchema } from '$lib/yupSchemas';
- navbarVisible.set(true);
+ navbarVisible.set(false);
const { t } = getLocalization();
diff --git a/frontend/src/routes/edit.svelte b/frontend/src/routes/edit.svelte
index 31475ca..e809c80 100644
--- a/frontend/src/routes/edit.svelte
+++ b/frontend/src/routes/edit.svelte
@@ -32,7 +32,7 @@
import { navbarVisible } from '$lib/stores';
import { dataSchema } from '$lib/yupSchemas';
- navbarVisible.set(true);
+ navbarVisible.set(false);
const { t } = getLocalization();