diff --git a/frontend/package.json b/frontend/package.json index 6e46752..dd34326 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -51,6 +51,7 @@ "js-cookie": "^3.0.1", "luxon": "^2.5.0", "mapbox-gl": "^2.9.2", + "minisearch": "^5.0.0", "plausible-tracker": "^0.3.8", "postcss": "^8.4.16", "postcss-import": "^14.1.0", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index e79a3b9..79d2e1e 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -39,6 +39,7 @@ specifiers: js-cookie: ^3.0.1 luxon: ^2.5.0 mapbox-gl: ^2.9.2 + minisearch: ^5.0.0 plausible-tracker: ^0.3.8 postcss: ^8.4.16 postcss-import: ^14.1.0 @@ -74,7 +75,7 @@ devDependencies: '@sentry/tracing': 7.11.1 '@sveltejs/adapter-auto': 1.0.0-next.64 '@sveltejs/adapter-node': 1.0.0-next.86 - '@sveltejs/kit': 1.0.0-next.420_svelte@3.49.0+vite@3.0.8 + '@sveltejs/kit': 1.0.0-next.421_svelte@3.49.0+vite@3.0.8 '@tailwindcss/typography': 0.5.4_tailwindcss@3.1.8 '@types/cookie': 0.5.1 '@types/js-cookie': 3.0.2 @@ -103,6 +104,7 @@ devDependencies: js-cookie: 3.0.1 luxon: 2.5.0 mapbox-gl: 2.9.2 + minisearch: 5.0.0 plausible-tracker: 0.3.8 postcss: 8.4.16 postcss-import: 14.1.0_postcss@8.4.16 @@ -574,10 +576,10 @@ packages: - supports-color dev: true - /@sveltejs/kit/1.0.0-next.420_svelte@3.49.0+vite@3.0.8: + /@sveltejs/kit/1.0.0-next.421_svelte@3.49.0+vite@3.0.8: resolution: { - integrity: sha512-9m/uWbd7Osj474TrkjRZ2x784PZzO6akxDFGfaEoFS5AsRUnDFRJ0HWHHdymy170aJsvlu20ZpLTNbbS5a95+g== + integrity: sha512-DtrU43PKz8xR52aVXVyYCssSoB0LX9D1QZLsVEFc/vGppBAe+0eJCCFHH1BqdXoIPHzp3FhpGGsK7jt5l7XjOw== } engines: { node: '>=16.9' } hasBin: true @@ -3241,6 +3243,13 @@ packages: yallist: 4.0.0 dev: true + /minisearch/5.0.0: + resolution: + { + integrity: sha512-VEwBhl8aFtc2UG2XmP7a4XaZxVfNhe7GvB2W/ZRGbLL3P3LbBhkoOezBWsMqG8Mr5VonqXAMRWth79XXKja1bQ== + } + dev: true + /minizlib/2.1.2: resolution: { diff --git a/frontend/src/lib/dashboard/main_slider.svelte b/frontend/src/lib/dashboard/main_slider.svelte new file mode 100644 index 0000000..0fa093e --- /dev/null +++ b/frontend/src/lib/dashboard/main_slider.svelte @@ -0,0 +1,232 @@ + + + +
+ + {#each quizzes as quiz} + + +
+
+ + +
+

+ {quiz.title} +

+

+ {quiz.description} +

+
+

+ {quiz.title} +

+
+
+

{quiz.questions.length} Questions

+
+ {#if quiz.public} + + + + {$t('words.public')} + {:else} + + + + {$t('words.private')} + {/if} +
+
+
+ Edit + +
+
+
+ + {#each quiz.questions as question} + +
+
{question.question}
+ {#if question.image} +
+
+ Not provided +
+
+ {/if} +

+ + + + {question.time}s +

+ {#if question.type === QuizQuestionType.ABCD || question.type === undefined} +
+ {#each question.answers as answer, index_answer} +
+

+ {answer.answer} +

+
+ {/each} +
+ {:else if question.type === QuizQuestionType.RANGE} +

+ All numbers between {question.answers.min_correct} + and {question.answers.max_correct} are correct, where + numbers between {question.answers.min} and {question + .answers.max} can be selected. +

+ {/if} +
+
+ {/each} + +
+
+ + {/each} + +
diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte index 422d097..0bc8321 100644 --- a/frontend/src/routes/dashboard/+page.svelte +++ b/frontend/src/routes/dashboard/+page.svelte @@ -5,10 +5,11 @@ --> @@ -118,125 +124,59 @@
{#if quizzes.length !== 0} -
-
-
- - - - - - - - - - - - - - {#each quizzes as quiz} - - - - - - - - - + {/each} - -
- {$t('words.title')} - - {$t('overview_page.created_at')} - - {$t('overview_page.question_count')} - - {$t('words.play')} - - {$t('words.edit')} - - {$t('words.delete')} - - {$t('words.public')} -
+ {:then c} +
+
+
+ + +
+ {#if quizzes_to_show.length === 0 && suggestions.length !== 0} +
    + {#each suggestions as res} +
  • + - {quiz.title} -
- {formatDate(quiz.created_at)} - - {quiz.questions.length} - - - - {$t('words.edit')} - - - - {#if quiz.public} - ✅ - {:else} - ❌ - {/if} -
+ + {/if}
-
+ + {/await} {:else}

{$t('overview_page.no_quizzes')} diff --git a/frontend/src/routes/edit/+page.svelte b/frontend/src/routes/edit/+page.svelte index 763949f..edbca73 100644 --- a/frontend/src/routes/edit/+page.svelte +++ b/frontend/src/routes/edit/+page.svelte @@ -38,6 +38,7 @@ export let data; let { quiz_id } = data; + console.log(quiz_id); let quiz_data: Data; const get_quiz = async (): Promise => { @@ -76,7 +77,7 @@ {:then _} {#if quiz_data !== undefined} - + {/if} {:catch err}