Skip to content

Commit

Permalink
♻️ Refactor QuestionStatisticsForQuestion component to simplify props…
Browse files Browse the repository at this point in the history
… and improve layout
  • Loading branch information
Malte2036 committed Oct 30, 2024
1 parent 5655527 commit 29cf08f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
14 changes: 2 additions & 12 deletions src/lib/quiz/question/QuestionStatisticsForQuestion.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<script lang="ts">
import type { AnsweredCountData } from '../../../routes/(main)/quiz/[type]/[questionId]/+page.server';
import QuestionsStatistics from './QuestionsStatistics.svelte';
import type { QuestionType } from '$lib/model/question';
import type { AnsweredCountData } from '../../../routes/(main)/quiz/[type]/[questionId]/+page.server';
export let answeredCountData: AnsweredCountData | undefined;
export let currentQuestionAnsweredCountData: AnsweredCountData | undefined;
export let questionType: QuestionType;
function getQuizTypeName(type: QuestionType) {
switch (type) {
Expand Down Expand Up @@ -42,7 +39,7 @@
/>
</div>
<span class="text-sm text-gray-600 whitespace-nowrap font-medium">
<span class="inline-block w-[4ch] text-right">{currentCorrectPercentage ?? ''}</span>%
<span class="inline-block min-w-[4ch] text-right">{currentCorrectPercentage ?? ''}</span>%
richtig
</span>
</div>
Expand All @@ -52,11 +49,4 @@
Mal richtig
</p>
</div>

<div>
<h3 class="text-lg font-medium text-gray-700 mb-2">
Globale Statistik {getQuizTypeName(questionType)}
</h3>
<QuestionsStatistics {answeredCountData} {questionType} />
</div>
</div>
6 changes: 1 addition & 5 deletions src/routes/(main)/quiz/[type]/[questionId]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@
/>
</div>
</div>
<QuestionStatisticsForQuestion
{answeredCountData}
{currentQuestionAnsweredCountData}
{questionType}
/>
<QuestionStatisticsForQuestion {currentQuestionAnsweredCountData} />
</div>
</div>

0 comments on commit 29cf08f

Please # to comment.