Further cleanup, mostly with svelte 5 migration placeholder cleanup
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// import type { PageLoad } from './$types';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = async ({ fetch }) => {
|
||||
export const load: PageLoad = async ({ fetch }) => {
|
||||
const res = await fetch('/api/v1/results/list?include_quiz=true');
|
||||
let json;
|
||||
if (res.ok) {
|
||||
|
||||
@@ -79,8 +79,6 @@ SPDX-License-Identifier: MPL-2.0
|
||||
{#if selected_tab === SelectedTab.Overview}
|
||||
<div in:fade|global={{ duration: 150 }}>
|
||||
<GeneralOverview
|
||||
questions={data.results.questions}
|
||||
answers={data.results.answers}
|
||||
scores={data.results.player_scores}
|
||||
title={data.results.title}
|
||||
timestamp={data.results.timestamp}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
// import type { PageLoad } from './$types';
|
||||
|
||||
export const load = async ({ params, fetch }) => {
|
||||
export const load: PageLoad = async ({ params, fetch }) => {
|
||||
const res = await fetch(`/api/v1/results/${params.result_id}?include_quiz=true`);
|
||||
let json;
|
||||
if (res.ok) {
|
||||
@@ -15,4 +14,4 @@ export const load = async ({ params, fetch }) => {
|
||||
return {
|
||||
results: json
|
||||
};
|
||||
}; //satisfies PageLoad;
|
||||
};
|
||||
|
||||
@@ -11,14 +11,6 @@ SPDX-License-Identifier: MPL-2.0
|
||||
const { t } = getLocalization();
|
||||
|
||||
interface Props {
|
||||
questions: Question[];
|
||||
answers: {
|
||||
username: string;
|
||||
answer: string;
|
||||
right: boolean;
|
||||
tike_taken: number;
|
||||
score: number;
|
||||
}[][];
|
||||
scores: {
|
||||
[key: string]: string;
|
||||
};
|
||||
@@ -26,7 +18,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
let { questions, answers, scores, title, timestamp }: Props = $props();
|
||||
let { scores, title, timestamp }: Props = $props();
|
||||
|
||||
const usernames = Object.keys(scores);
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ SPDX-License-Identifier: MPL-2.0
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log(custom_field);
|
||||
</script>
|
||||
|
||||
<div class="w-full">
|
||||
|
||||
@@ -7,7 +7,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
<script lang="ts">
|
||||
import type { Question } from '$lib/quiz_types';
|
||||
import { fly } from 'svelte/transition';
|
||||
import QuestionTab from './question_tab_thing.svelte';
|
||||
import QuestionTab from './question_tab_dropdown.svelte';
|
||||
import { QuizQuestionType } from '$lib/quiz_types';
|
||||
import { getLocalization } from '$lib/i18n';
|
||||
|
||||
@@ -16,12 +16,12 @@ SPDX-License-Identifier: MPL-2.0
|
||||
interface Props {
|
||||
questions: Question[];
|
||||
answers: {
|
||||
username: string;
|
||||
answer: string;
|
||||
right: boolean;
|
||||
tike_taken: number;
|
||||
score: number;
|
||||
}[][];
|
||||
username: string;
|
||||
answer: string;
|
||||
right: boolean;
|
||||
tike_taken: number;
|
||||
score: number;
|
||||
}[][];
|
||||
}
|
||||
|
||||
let { questions, answers }: Props = $props();
|
||||
@@ -57,7 +57,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
</script>
|
||||
|
||||
<div class="w-full flex justify-center">
|
||||
<div class="w-11/12 flex flex-col w-full gap-4">
|
||||
<div class="flex flex-col w-full gap-4">
|
||||
{#each questions as question, i}
|
||||
<div class="transition-all">
|
||||
<div
|
||||
|
||||
-2
@@ -11,7 +11,6 @@ SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
const { t } = getLocalization();
|
||||
|
||||
|
||||
interface Answer {
|
||||
username: string;
|
||||
answer: string;
|
||||
@@ -26,7 +25,6 @@ SPDX-License-Identifier: MPL-2.0
|
||||
}
|
||||
|
||||
let { question, answers }: Props = $props();
|
||||
// console.log(question);
|
||||
|
||||
const get_answer_count_for_answer = (answer: string): number => {
|
||||
let count = 0;
|
||||
Reference in New Issue
Block a user